[fpc-devel] MACRO - correct syntax?

Sven Barth pascaldragon at googlemail.com
Sun Feb 25 13:15:45 CET 2018


Am 25.02.2018 12:14 schrieb "Mark Morgan Lloyd" <
markMLl.fpc-devel at telemetry.co.uk>:

On 25/02/18 10:30, Florian Klämpfl wrote:

> Am 25.02.2018 um 11:12 schrieb Mark Morgan Lloyd:> On 25/02/18 02:15, Ozz
> Nixon wrote:>> {$MACRO ON}>> {$DEFINE _CTASSERT(X,Y,Z):=assert(x=y,z);}>>
> Begin   _CTASSERT(1,1,'Constant failed.');end.> > I don't believe
> parameters are supported :-(>
> Why so sad? They are not supported on purpose :)
>

Because it messes up what the OP was trying to do, which is not necessarily
something to feel good about.


Yes, we definitely feel good about this, because we don't *want* parameter
support in FPC's macro handling.

What the author wants to achieve here can also be done using a procedure
marked as inline. As long as the unit containing the procedure is rebuild
when assertions are enabled or disabled everything will work as expected
and even the whole call will disappear if it isn't needed. Much cleaner
than a preprocessor.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180225/f3eb76b1/attachment.html>


More information about the fpc-devel mailing list