This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.
Section: 18.104.22.168.2 [macro.names] Status: CD1 Submitter: James Kanze Opened: 2001-01-11 Last modified: 2017-02-03
Priority: Not Prioritized
View all other issues in [macro.names].
View all issues with CD1 status.
Paragraph 2 of 22.214.171.124.2 [macro.names] reads: "A translation unit that includes a header shall not contain any macros that define names declared in that header." As I read this, it would mean that the following program is legal:
#define npos 3.14 #include <sstream>
since npos is not defined in <sstream>. It is, however, defined in <string>, and it is hard to imagine an implementation in which <sstream> didn't include <string>.
I think that this phrase was probably formulated before it was decided that a standard header may freely include other standard headers. The phrase would be perfectly appropriate for C, for example. In light of 126.96.36.199 [res.on.headers] paragraph 1, however, it isn't stringent enough.
For 188.8.131.52.2 [macro.names], replace the current wording, which reads:
Each name defined as a macro in a header is reserved to the implementation for any use if the translation unit includes the header.168)
A translation unit that includes a header shall not contain any macros that define names declared or defined in that header. Nor shall such a translation unit define macros for names lexically identical to keywords.
168) It is not permissible to remove a library macro definition by using the #undef directive.
with the wording:
A translation unit that includes a standard library header shall not #define or #undef names declared in any standard library header.
A translation unit shall not #define or #undef names lexically identical to keywords.
[Lillehammer: Beman provided new wording]