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

后端 未结 9 1468
眼角桃花
眼角桃花 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条回答
  •  -上瘾入骨i
    2020-12-02 05:01

    I'd like to add on for the #else case:

    #if 0
       /* Code here will NOT be complied. */
    #else
       /* Code will be compiled. */
    #endif
    
    
    #if 1
       /* Code will be complied. */
    #else
       /* Code will NOT be compiled. */
    #endif
    

提交回复
热议问题