What exactly does an #if 0 … #endif block do?

后端 未结 9 1478
眼角桃花
眼角桃花 2020-12-02 04:38

In C/C++

What happens to code placed between an #if 0/#endif block?

#if 0

//Code goes here

#endif
         


        
9条回答
  •  鱼传尺愫
    2020-12-02 05:23

    Not quite

    int main(void)
    {
       #if 0
         the apostrophe ' causes a warning
       #endif
       return 0;
    }
    

    It shows "t.c:4:19: warning: missing terminating ' character" with gcc 4.2.4

提交回复
热议问题