Re: Compiler directives
- From: "Deepak Shenoy (TeamB)" <nomail@xxxxxxxxxx>
- Date: 31 Jan 2006 01:32:21 -0700
Abdullah Kauchali wrote:
> Should they be avoided? Why?
I think some are very useful:
{$M+} I have had to use this in the past when I needed to generate RTTI
information but did not want to derive from TPersistent.
{$IFDEF}, {$DEFINE} etc. : Important if you're building commercial
components or libraries that support different Delphi versions. Sort of
Important if you might want a copy of code that is specific to one
customer (when you sell to many) but there usually are other ways to do
this, including code forking which is perhaps the easiest business
solution.
{$APPTYPE CONSOLE} I think the compiler needs this to emit some
information in the EXE.
{$ASSERTIONS ON} Use it for developer level error catching. Tricky if
somebody puts run-time condition checks in there, but that's a training
thing.
{$DENYPACKAGEUNIT}{$DESIGNONLY} etc. are package level compiler
instructions
{$I+} Have had to use this when using type "Text" and
OpenFile/Reset/Rewrite functions.
There are others that one tends to use because they are debug options,
optimization and so on.
{$I} Well this is only useful in some cases, and I think the difference
between doing this vs. using the unit initialization and finalization
sections don't run. But, is useful for IFDEF sets.
I've never had to use:
{$Align}, {$Stackchecks}, {$M}, {$R}, {$REALCOMPATIBILITY}, {$U} or
{$Y}
I think are dangerous to use at all:
{$BoolEval On} {$Warnings Off}
--
Deepak Shenoy (TeamB)
http://shenoyatwork.blogspot.com
.
- Follow-Ups:
- Re: Compiler directives
- From: Abdullah Kauchali
- Re: Compiler directives
- From: Oliver Townshend
- Re: Compiler directives
- References:
- Compiler directives
- From: Abdullah Kauchali
- Compiler directives
- Prev by Date: Re: Borland/Delphi Dying blog entry from Ken Henderson at MS
- Next by Date: Re: Opinion: Dell 20.1" LCD monitor or D2006 Pro?
- Previous by thread: Re: Compiler directives
- Next by thread: Re: Compiler directives
- Index(es):