is it possible via {$define xx} to define an constant value (like CompilerVersion). For example I would like to do something like
{$define FrogCount=25}
but seam to not work :(
I need to do this inside a myincfile.inc file because I need to do stuff like
interface
{$I myincfile.inc}
uses
{$IF FrogCount = 25}
toto;
{$else}
lala;
{$endif}
and you understand that here I can't do stuff like
const FrogCount = 25;
inside myincfile.inc else I have a compiler error :(
CodePudding user response:
In Delphi, you cannot define a constant value in a {$DEFINE ident}
statement, you can define only the ident
name by itself, which is then usable only with {$IF(N)DEF ident}
and {$IF (NOT) DEFINED(ident)}
statements.
In FreePascal, you can define a constant value in a {$DEFINE ident:=expr}
statement, but only when {$MACRO ON}
is enabled. See Macros in FreePascal's documentation.