[fpc-pascal] Proper preprocessor?
Marcos Douglas B. Santos
md at delfire.net
Sun Jun 24 14:34:23 CEST 2018
On Fri, Jun 22, 2018 at 6:47 PM, Sven Barth via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:
>
>> [...]
>
> Why not simply test it?
>
> That said you can also do this:
>
> === code begin ===
>
> {$macro on}
>
> {$ifdef debug}
> {$define foo := foo_debug}
> {$else}
> {$define foo := foo_run}
> {$endif}
>
> uses
> foo;
>
> begin
> foo.SomeFunc;
> end.
>
> === code end ===
>
> Though more often than not such things are done by simply using a different
> set of units with the same names in a different unit path.
Because I was on the road, without my laptop, and I didn't want to
forget this :)
And your way is even better, thank you.
Best regards,
Marcos Douglas
More information about the fpc-pascal
mailing list