Public Comment Number PC-UK0261 ISO/IEC CD2 9899 (SC22N2794) Public Comment =========================================== Date: 1998-09-22 Author: N.M Maclaren Author Affiliation: Self Postal Address: University of Cambridge, Computer Laboratory, New Museums Site, Pembroke Street, Cambridge CB3 3QG, United Kingdom E-mail Address: Telephone Number: +44 1223 334761 Fax Number: +44 1223 334679 Category: Normative change to existing feature retaining the original intent Committee Draft subsection: 6.10.8 Title: Distinguishing C89 from C9X Detailed description: Because of the widespread and important changes between C89 and C9X, it is very important for an application to be able to determine which language the implementation is supporting. __STDC_VERSION__ may have been intended for this purpose, but is not entirely reliable and has the wrong properties. Amongst other faults, it is nowhere stated that it will be increased, or even continue to have integer values, so it is not possible to test in a program designed for long-term portability. There are two possible solutions to this. The first is to use the value of __STDC__ as an indicator of the C language variant, by adding wording like: __STDC__ shall be set to 2, to indicate the C language described in this document, rather than 1, which indicated the language described in ISO/IEC 9899:1990 and ISO/IEC 9899:AMD1:1995. That is an entirely reliable indicator of whether an implementation conforms to C89 or C9X, and follows existing practice (many vendors use a value of 0 to indicate K&R/standard intermediates.) A second approach is to define the meaning of __STDC_VERSION__ more precisely, by adding wording like: It is the intention of this standard that the value of __STDC_VERSION__ may be used to determine which revision of the standard an implementation is conforming to, and that it will remain a constant of type long that is increased at each revision. That is not entirely reliable, but would probably do.