Is __COUNTER__ macro portable?
3 answers
He definitely is n't .
This is a compiler extension ( GNU C extensions )
Common predefined macros are GNU C extensions.
and Microsoft-specific ,
Predefined Macros for Microsoft:
__ COUNTER __
clang is also supported as a language extension.
+3
source to share
GCC Manual, section General Predefined Macros , specify
Common predefined macros are GNU C extensions.
I also haven't seen this macro in the C99, C11, or C ++ 11 standards.
As for practical portability: Clang supports it as well.
+2
source to share
It seems NO . When I ctrl + f "__COUNTER__" to standard pdf , I didn't find anything> o <
0
source to share