WG 14 Document number | N1345 |
Date | 2008-09-10 |
Project | Programming Language C |
Reference | ISO/IEC IS 9899:1999 |
Reply to | Nick Stoughton |
USENIX Association | |
nick@usenix.org |
Several recent proposals for the C1x revision have introduced new keywords, functions, or macros that require the implementation to "do the dance": the keyword (function or macro) is actually named _[UpperCaseChar]name, and a header is required to define the natural spelling of the keyword. For example, _Thread_local, which can be spelled thread_local if the correct header (<thread.h>) is included.
An alternative approach to "doing the dance" is proposed here. It is not intended that necessarily every occurence of _[UpperCaseChar]name need be replaced by this mechanism. It simply is intended to increase our arsenal of methods when we need to introduce such new keywords etc.
POSIX suffered from a similar problem, and in about 1995 or 1996 adopted the approach of reserving the namespace:
The prefixes posix_, POSIX_, and _POSIX_ are reserved for use by IEEE Std 1003.1-2001 and other POSIX standards.
This proposal suggests a similar approach for C,
The prefixes stdc_, STDC_, and __STDC_ are reserved for future standardization.
This would permit (but not require) us to use the keyword stdc_thread_local for thread local storage, for example.
Indeed, the current standard already reserves STDC as a prefix for pragmas (6.11.8) and __STDC_ for macros (6.11.9). It is unclear why the committee stopped at pragmas and macros. A Google code search shows that very few applications would be affected by such a reservation, and where applications do "break" the rule, they do so where they are mapping something to the standard C way of doing it.
Replace 6.11.8 and 6.11.9 in their entirety with the following:
6.11.8 Pragma directives
Pragmas whose first preprocessing token is STDC are reserved for future standardization.
6.11.9 Predefined macro names Macro names beginning with __STDC_ are reserved for future standardization.
6.11.x Reserved Names The prefixes stdc_, STDC_, and __STDC_ are reserved for future standardization.