Talk:Delphi compiler directives

From RAD Studio
Jump to: navigation, search

A compiler directive is a comment with a special syntax. ... A compiler directive starts with a $ as the first character after the opening comment delimiter ...

I think it should be mentioned here that //-style comments cannot be used for directives:

{$hints off}        // a directive
(*$hints off*)      // a directive
//$hints off        // just a commentary, ignored


Switch directives can be grouped in a single compiler directive comment by separating them with commas with no intervening spaces.

It should be noted that the above doesn't work for long-named directives:

{$optimization on,hints off}        // everything starting with "," is treated like a comment here


Fix the alignment, fix the $M directive (the second parameter cannot be less than the first one) and replace $StackChecks with something newer ($StackChecks is provided for backward compatibility only and it is ignored by the compiler -- confirmed by Allen Bauer):

{$B+}
{$Optimization on}
{$R- Turn off range checking}
{$I TYPES.INC}
{$M 4096,32768}
{$DEFINE Debug}
{$IFDEF Debug}
{$ENDIF}


Replace the name of the Delphi.NET compiler (dccil) with the name of the Delphi compiler (dcc32): 2 occurrences.


The Project|Options dialog box contains many of the compiler directives ... you can specify compiler directives on the command line ...

It's probably worth mentioning that the directives embedded into the source code have the priority over those specified on the command line or in the project options.

-- Blaise


Response

Hi Blaise -

Your well-appreciated comments have been incorporated into the topic.

Sorry for the delay - the work was done in the recent past. Thanks for (separately) making corrections in the text and hyperlinks of "Programs and Units". And we hope you continue to enjoy using the docwiki.

RAD-8020, RAD-8323 KrisHouser 16:01, 12 April 2011 (PDT)