#define IDENTIFIER without a token

前端 未结 4 535
长发绾君心
长发绾君心 2020-12-06 00:05

What does the following statement mean:

#define FAHAD

I am familiar with the statements like:

#define FAHAD 1
4条回答
  •  暖寄归人
    2020-12-06 00:40

    Defining a constant without a value acts as a flag to the preprocessor, and can be used like so:

    #define MY_FLAG
    #ifdef MY_FLAG
    /* If we defined MY_FLAG, we want this to be compiled */
    #else
    /* We did not define MY_FLAG, we want this to be compiled instead */
    #endif
    

提交回复
热议问题