77 c++ c-preprocessor preprocessor-directive
我对c ++中的预处理器指令有疑问:
例如:
#ifndef QUESTION
//some code here
#ifndef QUESTION
//some code here
#endif
#endif
Run Code Online (Sandbox Code Playgroud)
利用它我们可以用这种方式,并且可以在C++编译器的匹配ifndef,并endif以正确的方式?
Arm*_*yan 102
我们可以.该#endif陈述与之前#if #ifdef或之前#ifndef没有相应的陈述相匹配#endif.
例如
#if ----------|
#if -----| |
#endif ---| |
#endif --------|
Run Code Online (Sandbox Code Playgroud)
Fre*_*Foo 44
是的,你可以嵌套#if/ #endif阻止.一些C编码风格会告诉你写
#ifdef CONDITION1
# ifdef CONDITION2
# endif
#endif
Run Code Online (Sandbox Code Playgroud)
使用空格来表示嵌套的级别.
| 归档时间: |
|
| 查看次数: |
32239 次 |
| 最近记录: |