Difference between preprocessor directives #if and #ifdef -


The difference between the two following preprocessor control statements (if any).

  #if  

and

  #ifdef  

You can display the difference by:

  #define FOO 0 #if FOO // This is not compiled This will be #endif #ifdefFoo // will be compiled for the  value  symbol #endif  

#if while #ifdef checks the symbol existence (regardless of its value).


Comments