|
Boost : |
From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2005-08-30 03:41:58
> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Suman Cherukuri
> I'm using general 'C' compiler in this project (hence I
> cannot use boost headers). I want to write a macro as follows;
>
> #define ERR(x, y) \
> { \
> # ifndef ERR##x \
> # define ERR##x \
> # else \
> # error ERR##x already defined\
> # endif
> y = x; \
> }
As mentioned by Graeme, macros cannot expand to preprocessing directives. Or,
more precisely, they cannot expand to anything that will be _interpreted_ as
preprocessing directives. In the above, because it is a function-like macro,
the # token acts as a stringizing operator. However, applying the stringizing
operator to anything but a formal argument is ill-formed.
Regards,
Paul Mensonides
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk