Date: Thu, 23 Aug 2007 12:16:32 +0200
> unfortunately the C preprocessor seems to stupid to do a string
> #if (BLA_BLA == "bla_bla")
> seems not possible; or is there a cool hack to check for string
Strictly speaking, the C syntax does not allow string comparison (it
compares string addresses !), so the statement needed would have been:
#if strcmp(BLA_BLA, "bla_bla") == 0
But strcmp() is not defined by the preprocessor, so the expression is
not a constant expression, as the #if semantics requires it to be :-(
I some C preprocessors, I have meet some deviances to the standard
semantics requirements. For example,
#define CURLVERSION_NOW CURLVERSION_FOURTH
#if CURL_VERSION_NOW == CURLVERSION_FOURTH
works for the OS/400 compiler (CURLVERSION_FOURTH being an enum member,
thus an identifier).
But you shouldn't use such dialect in PORTABLE code !!!
I don't know what string you want to test, but maybe there is a way to
rewrite the test using an integer value that is related to your target
Else, as you say, you have to prepare your test in the configure script.
Received on 2007-08-23