If the runtime check is ok, then you can check the length of the string replacement:
#define REAL_STRINGIZE(x) #x
#define STRINGIZE(x) REAL_STRINGIZE(x)
if (STRINGIZE(funcprototype)[0] == '\0') {
}
else {
}
I donβt think there is a general case, "this macro is replaced by an empty sequence of tokens." This is a similar problem: "is it possible to compare two sequences of tokens for equality", which is impossible to do at compile time.
source
share