Hi
Is it possible to check the value of a macro argument?
for example here is the start of my macro
#define fred messageOK
#define MyMacro(scope) <rest of macro>
I want to be able to check if 'scope' is equal to 'fred'
Thanks for any help
Hi
Is it possible to check the value of a macro argument?
for example here is the start of my macro
#define fred messageOK
#define MyMacro(scope) <rest of macro>
I want to be able to check if 'scope' is equal to 'fred'
Thanks for any help
How would you do the comparison with numerical variables or constants, or string variable or constants?
#define macros are translated by the preprocessor. Any comparisons would be done in normal C code after that translation.
For example:
would be seen by the compiler as:Code:#define X 10 #define Y 5 // ... if(X > Y) { // ... }
String comparisons would need to be done by string functions such as strcmp(), strncmp(), etc...Code:// ... if(10 > 5) { // ... }