Public Comment Number PC-UK0284 ISO/IEC CD2 9899 (SC22N2794) Public Comment =========================================== Date: 1998-12-13 Author: C.D.W.Feather Author Affiliation: Self Postal Address: Demon Internet Ltd. 322 Regents Park Road London N3 2QQ United Kingdom E-mail Address: Telephone Number: +44 181 371 1138 Fax Number: +44 181 371 1037 Category: Normative change to existing feature retaining the original intent Committee Draft subsection: 6.10.3 Title: Problems with extended characters in object-like macros Detailed description: When an object-like macro is #defined, there is no requirement for a delimiter between the macro identifier and the replacement list. This can be a problem when extended characters are involved - for example, some implementations view $ as valid in a macro identifier while others do not. Thus the line: #define THIS$AND$THAT(x) ((x)+42) can be parsed in either of two ways: Identifier Arguments Replacement list THIS - $AND$THAT(x) ((x)+42) THIS$AND$THAT x ((x)+42) TC1 addressed this by requiring the use of a space in certain circumstances so as to eliminate the ambiguity. However, this requirement has been removed in C9X for good reasons. Regrettably this reintroduces the original ambiguity. The proposed solution is to require that the macro identifier in the definition of object-like macros be followed by white space or by one of the basic graphic characters that is not ambiguous. Most code already uses white space and such code will not be affected. Code such as: #define x+y z which actually means #define x +y z will also not be affected by the first option. The only cases that are affected will require a diagnostic, thus eliminating the ambiguity. Insert a new Constraint in 6.10.3, preferably: In the definition of an object-like macro there shall be white space between the identifier and the replacement list unless the latter begins with one of the 26 graphic characters in the basic character set other than ( _ or \. (or equivalent wording) or alternatively: In the definition of an object-like macro there shall be white space between the identifier and the replacement list.