On 06/12/2025 11:10, Michael Van Canneyt via fpc-devel wrote:
On Fri, 5 Dec 2025, Martin Frb via fpc-devel wrote:
$define/$Ifdef don't just take (name) identifiers.
They also take numbers, <strike>and expressions. </strike>
Well actually, numbers.
{$define 2}
{$IFDEF 2} .... {$ENDIF}
Seriously ?
The inventive ways by which people try to shoot themselves in the foot
never
cease to amaze me...
They do it with lots of enthusiasm, it seems :-)
Ok, so the docs says defines a "name" or "symbol", it does not refer to
"identifier". Which means I guess numbers are in that scope.
And I just realised, the above can be used with macros.
{$macro on}
{$define 0=1}
begin
write(random(123) / 0);
should work ... ;)
_______________________________________________
fpc-devel maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel