
On 8/11/2011 10:25 AM, Mathias Gaunard wrote:
On 11/08/2011 15:05, damien benoist wrote:
Is it possible for you to make the macro defined to some special value
rather than being undefined ?
If you can list the names of all possible macros in some place, then I think you can make some macro that tests if it is defined or not, assuming the definition is unary.
I would like to see that code. Within a macro you can test a macro for a value, given a limited subset of possible values, but I do not think you can test whether a macro is actually defined or not without first setting another macro to a value based on it, as in: #if defined(SOME_MACRO) #define ANOTHER_MACRO 1 #else #define ANOTHER_MACRO 0 #endif #define TEST_MACRO BOOST_PP_IIF(ANOTHER_MACRO,DO_WHEN_SOME_MACRO_DEFINED,DO_WHEN_SOME_MACRO_UNDEFINED) Eddie