$define/$Ifdef don't just take (name) identifiers.

They also take numbers, <strike>and expressions. </strike>

Well actually, numbers.
{$define 2}
{$IFDEF 2} .... {$ENDIF}


The below at first looked like expressions too (but as literal text)
But like any directive, it parses until it has the directive (in this case the first ident "2" and ignores the rest "+1" as comment.

The below is just about the "2":
{$define 2+1}
{$IFDEF 1+2} not compiled {$ENDIF}
{$IFDEF 2+1} foo; {compiled} {$ENDIF}
{$IFDEF 2+ 1} foo; {compiled} {$ENDIF} // note the space


See also
https://forum.lazarus.freepascal.org/index.php/topic,72937.0.html
_______________________________________________
fpc-devel maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to