Public Comment Number PC-UK0017 ISO/IEC CD 9899 (SC22N2620) Public Comment =========================================== Date: 1998-01-17 Author: Clive D.W. Feather Author Affiliation: Self Postal Address: Demon Internet Limited 322 Regents Park Road London N3 2QQ United Kingdom E-mail Address: Telephone Number: +44 181 371 1138 Fax Number: +44 181 371 1037 Number of individual comments: 1 Comment 1. Category: Normative change to existing feature retaining the original intent Committee Draft subsection: 6.3.9 Title: fix pointer comparison Detailed description: DR 172 addressed a number of defects in the rules for pointer comparison, and the DR authors suggested new wording to fix this. This issue was also raised in WG14 papers N720 and N783. Following other changes in the Standard, this wording is no longer completely acceptable. Instead, replace 6.3.9 paragraphs 3 to 5 with the following text. The == (equal to) and != (not equal to) operators are analogous to the relational operators except for their lower precedence.[78] They yield 1 if the specified relation is true and 0 if it is false. The result has type /int/. For any pair of operands, one operator shall be true and the other false. If both of the operands have arithmetic type, the usual arithmetic conversions are performed. [[Insert the existing paragraph 5 here.]] Otherwise the operands are pointers; if one is a pointer to an object or incomplete type and the other has type pointer to a qualified or unqualified version of /void/, the former is converted to the type of the latter. Two pointers shall compare equal if both are null pointers, both are pointers to the same object (including a pointer to an object and a subobject at its beginning), the same element of an array object, or the same function, if both are pointers to one past the end of the same array object, or if one is a pointer to one past the end of one array object and the other is a pointer to the start of a different array object that happens to be immediately after it in the address space.[79] Otherwise they shall compare unequal. Prepend to footnote 79: Two objects may be adjacent in memory because they are adjacent elements of some larger array object, because they are adjacent members of a structure with no padding between them, or because they are unrelated and the implementation chooses to place them adjacent in memory.