So far I've got as far as:
#define ADEFINE "23"
#pragma message ("ADEFINE" ADEFINE)
Which works, but what if ADEFINE isn't a string?
#define ADEFINE 23
#pragma message ("ADEFINE" ADEFINE)
causes:
warning: malformed ‘#pragma message’, ignored
Ideally I'd like to be able to deal with any value, including undefined.
To display macros which aren't strings, stringify the macro:
#define STRINGIFY(s) XSTRINGIFY(s)
#define XSTRINGIFY(s) #s
#define ADEFINE 23
#pragma message ("ADEFINE=" STRINGIFY(ADEFINE))
If you have/want boost, you can use boost stringize to do it for you:
#include <boost/preprocessor/stringize.hpp>
#define ADEFINE 23
#pragma message ("ADEFINE=" BOOST_PP_STRINGIZE(ADEFINE))