Why Compilation Does Not Fail?

后端 未结 1 978
故里飘歌
故里飘歌 2021-01-29 12:58

As expected, C/C++ compilation does fail with "warning: comparison between pointer and integer" for the program below:

#include 
int ma         


        
1条回答
  •  梦毁少年i
    2021-01-29 13:43

    In C, the macro false is defined as:

    #define false   0
    

    So you're comparing a pointer against 0, which is a valid null pointer constant.

    0 讨论(0)
提交回复
热议问题