在MSVC和C#中,可以使用
同样,在GCC/Clang中,
是否可能定义一个单一的宏,例如
基本上,我想避免做以下操作:
这样的事情有可能吗?
#pragma region
来标记代码段。同样,在GCC/Clang中,
#pragma mark
也可以实现同样的功能。是否可能定义一个单一的宏,例如
CODELABEL(label)
,可以同时适用于这两个编译器?基本上,我想避免做以下操作:
#ifdef _WIN32
#pragma region Variables
#else
#pragma mark Variables
#endif
bool MyBool;
int MyInt;
#ifdef _WIN32
#pragma region Methods
#else
#pragma mark Methods
#endif
void MyMethod();
void AnotherMethod();
...而是做类似于这样的事情:
CODELABEL( Variables )
bool MyBool;
int MyInt;
CODELABEL( Functions )
void MyMethod();
void AnotherMethod();
这样的事情有可能吗?
CODELABEL(MyLabel)
的地方给出了error C2059: syntax error : 'string'
。 - RectangleEquals