When trying to debug my code, I marked a few printf with this:
#if debug
printf(...);
#endif
And at the start of the file, I mistakenly wrote #define debug instead of #define debug 1
gcc threw the following error:
error: #if with no expression
Now I have 2 options:
- changing the define into
#define debug 1 - changing the if into
#ifdef debug
I know that upon seeing #define debug 1 the PP will replace each debug in my code to 1 and that's why #if debug in my code didn't work - the compiler sees no expression...
My question is, when I use #ifdef debug - what happens? I figure debug is saved somewhere and checked, but where and how?