I have some code that looks like this:
someFunc(value) { switch(value){ case 1: case 2: case 3: #ifdef SOMEMACRO case 4: case 5: #endif return TRUE; } return FALSE; }
SOMEMACRO is defined, and let’s say the value is 4.. Why does case 4 and 5 get skipped and FALSE is returned instead? 🙁
Is it because I don’t have a default case or am I not allowed to use an ifdef in the switch statement?
‘switch’ Isn’t Broken
to, more or less, quote The Pragmatic Programmer.
Go ahead and look somewhere else for the error. To convince yourself add
value = 4and#define SOMEMACROright there in someFunc.Make a clean build to make sure every dependancy is resolved.