Public Comment Number PC-UK0280 ISO/IEC CD2 9899 (SC22N2794) Public Comment =========================================== Date: 1998-12-12 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: Request for information/clarification Committee Draft subsection: 6.10 Title: Parsing ambiguity in preprocessing directives Detailed description: Consider parsing the following text during the preprocessing phase (translation phase 4): # if 0 xxxx # else yyyy # endif The third line fits the syntax for the first option of group-part, and thus generates two possible parsings. One of these will cause both text lines to be skipped, while the other only causes the second to be skipped. To fix this ambiguity. In the syntax in 6.10p1, change group-part to: group-part: non-directive new-line if-section control-line and add: non-directive: pp-tokens/opt Then add a new paragraph to the Constraints, after 6.10p3: If the first preprocessing-token (if any) in a non-directive is /#/, the second shall be an identifier other than one of those that appears in the syntax in this subclause. Such a non-directive shall only appear in a group that is skipped. This change has two (deliberate) side-effects: unknown preprocessing require a diagnostic if not skipped, and in any case cannot affect the state of conditional inclusion. If such a directive is recognised by the implementation, it can still interpret it in any desired way after outputting the diagnostic.