Is __COUNTER__ macro portable?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 18:25:11

It's definitely not standard.

It's a compiler extension (GNU C extensions)

The common predefined macros are GNU C extensions.

and a Microsoft-specific one,

Microsoft-Specific Predefined Macros:

__ COUNTER __

also supported by clang as language extension.

The standard doesn't mention it anywhere.

GCC manual, section Common Predefined Macros, states

The common predefined macros are GNU C extensions.

I've also never seen this macro in the C99, C11 or C++11 standards.

As for practical portability: Clang supports it, too.

It seems NO. When I ctrl+f "__COUNTER__" on standard pdf, I couldn't find anything >o<

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!