0 c c++ preprocessor-directive
哪个全局变量可以在预处理程序指令file.cpp中使用
int variable = 1;
#if variable >= 1
int a = 0;
#else
int a = 1;
#endif
Run Code Online (Sandbox Code Playgroud)
要么
file.cpp
const int variable = 1;
#if variable >= 1
int a = 0;
#else
int a = 1;
#endif
Run Code Online (Sandbox Code Playgroud)
或file.cpp
#include "header.h"
// extern in variable; in the header.h
#if variable >= 1
int a = 0;
#else
int a = 1;
#endif
Run Code Online (Sandbox Code Playgroud)
使用proprocessor指令中的变量的规则是什么?如果一个可以折叠的变量,它可以用在#if /#elif#else指令中吗?