I am trying to do the following evaluation: In my header file (define value can change):
#define X ((void *) 0)
In my function:
uint8_t foo() {
uint8_t value = 0;
#if ( X != 0 )
value = 1;
#endif
return value;
}
When I compile the code it throws the following errors:
#57: this operator is not allowed in a constant expression
#58: this operator is not allowed in a preprocessing expression
When I do operations to see if the DEFINE exists (or not) it works fine (#ifdef or #if defined(X)). But what I want is to be able to evaluate the value of X at compile time. Am I missing any flag or something I need to set in order to be able to make this work? I am using Green Hills compiler.