C ++ __COUNTER__定义
我有两个版本的c ++编译器安装在我的电脑上。其中一个识别 __ COUNTER __
宏,另一个不识别。在做了一些研究使程序编译之后,我还没有遇到 __ COUNTER __
的宏定义。这是一些特殊的宏由编译器做,或者我可以复制 __ COUNTER __
的定义到我的源代码,如果我可以复制它是我需要的代码。
I have two versions of a c++ compiler installed on my computer. One of them recognizes the __COUNTER__
macro and the other does not. After doing some research to make the program compile in both I have yet to come across the Macro definition for __COUNTER__
. Is this some special Macro done by the compiler or can I copy the definition for __COUNTER__
into my source code, if I can copy it what is the code I need.
__ COUNTER __
是几个常用编译器中内置的。无法手动定义。如果你遇到了不支持它的编译器,你最好的选择是通过支持它的预处理器运行你的代码,然后再将它送入编译器。
__COUNTER__
is a built-in in several common compilers. It is not possible to define manually. If you're stuck with a compiler that doesn't support it, your best option might be to run your code through a preprocessor that does support it before feeding it into the compiler.