3 ms·
You're not wrong to be concerned; all things beginning with '_' are reserved for use by the implementation: http://stackoverflow.com/questions/228783/what-are-
by binarycrusader 13y ago
You're not wrong to be concerned; all things beginning with '_' are reserved for use by the implementation:
http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier http://stackoverflow.com/questions/228783/what-are-the-rules...
Update: as another person points out, _Generic is now an official keyword as of C11.
- tomku 13y ago_Generic is a language keyword, not a user-defined macro. It uses an underscore-prefixed name (along with many other C11 keywords/features) precisely because those names are reserved and won't conflict with user code. Also, that SO post is about C++, not C. It might seem pedantic (particularly given that C actually does have the same rule for reserved names), but that's something to be careful about as there's significant divergence nowadays.
- binarycrusader 13y agoSorry; I didn't realise that _Generic is a C11 keyword: http://en.wikipedia.org/wiki/C11_(C_standard_revision) http://en.wikipedia.org/wiki/C11_(C_standard_revision) Also, that SO post is about C++, not C. No, it's about both C++ and C: Because C++ is based on the C standard (1.1/2, C++03) and C99 is a normative reference (1.2/1, C++03) these also apply, from the 1999 C Standard... See section 7.1.3 of the relevant standard: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf Also, the divergence has actually been lessened since the C++11 committee worked closely with the C11 committee to bring the standards closer together. That's part of why Microsoft is picking up a lot of C99 as part of their work for implementing C++11.
- tomku 13y agoGood catch on the C/C++ standard relation, I somehow completely missed that when I read the SO answer. Glad to hear that that situation is improving.