|
Boost : |
Subject: [boost] Re : [preprocessor] ifdef equivalent inside a macro, is it possible?
From: damien benoist (damien_benoist_at_[hidden])
Date: 2011-08-10 11:22:15
> > Would there be a way to do some "ifdef" inside a macro?
> > Could be in the form of a macro taking 3 args,
> > - 1st being the macro to test the existance of,
> > - 2nd being the value to expand in case 1st arg is a defined macro
> > - 3rd being the value to expand in case 1st arg is not a defined macro
> Not really.
> You can test whether a macro expands to 0 or 1 though.
Yes, I've seen that.
I think I've also seen the possibility to test wether it
expends to 0 or any number from 1 to some maximum.
And some people here also talked about chaos.
It seems that it also alowsto test wether a macro
expands to "0 and nothing (i.e. a placemarker)"
(chaos_pp_placemarker_if)
It is described as C99 specific (I suppose it uses __VA_ARGS__).
But what I would like is to expand to some value
by default and another if a given macro is set.
Thanks for your answer.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk