Skip to content

Instantly share code, notes, and snippets.

@kkdai
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save kkdai/9014723 to your computer and use it in GitHub Desktop.

Select an option

Save kkdai/9014723 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <stdio.h>
#define FOO_Def
#define FOO_Def2 5
int main(int argc, const char * argv[])
{
#ifdef FOO_Def
printf ("FOOO\n");
#endif
// it will print out
#ifdef FOO_Def2
printf ("FOOO\n");
#endif
// it will print out
//if (0==FOO_Def) Compiler will error, because FOO_Def don't have any value.
if (0==FOO_Def2) //Need define value for value check.
printf ("FOOO\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment