Difference between preprocessor directives #if and #ifdef

前端 未结 2 535
甜味超标
甜味超标 2021-01-30 20:11

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

#if

and

#ifdef
2条回答
  •  故里飘歌
    2021-01-30 20:34

    #ifdef FOO
    

    is a shortcut for:

    #if defined(FOO)
    

    #if can also be used for other tests or for more complex preprocessor conditions.

    #if defined(FOO) || defined(BAR)
    

提交回复
热议问题