It doesn't.Originally posted by Omnius
...if the C++ standard does forbid the redefinition of keywords using macros...
gg
It doesn't.Originally posted by Omnius
...if the C++ standard does forbid the redefinition of keywords using macros...
gg
From 17.4.3.1.1:
"Nor shall such a translation unit define macros for names lexically identical to keywords."
Why attempt to fool readers by quoting the standard out of context?
gg17 - 1
This clause describes the contents of the C++ Standard Library, how a well-formed C++ program makes use of the library, and how a conforming implementation may provide the entities in the library.
Please don't try to make out that I'm trying to fool people, Codeplug. Feel free to refute what I said if you're able to, in which case I'll acknowledge it. At the moment, I don't see what you're trying to prove with your quote. It appears to me you simply reinforce what I've said. Your quote is consistent with what I said about the use of macros to redefine C++ keywords being ill-formed.Originally posted by Codeplug
Why attempt to fool readers by quoting the standard out of context?
gg
Either I'm correct, or I'm wrong. There's no attempt to fool people. That's just offensive nonsense on your part.
This has appropriate context and is self-explanatory:
This is ok. [EDIT] maybe not...sounded good at the time. [/EDIT]Code:17 Library introduction [lib.library] ... 17.3 Library-wide requirements [lib.requirements] 1 This subclause specifies requirements that apply to the entire C++ Standard library. ... ... 17.3.3 Constraints on programs [lib.constraints] 1 This subclause describes restrictions on C++ programs that use the facilities of the C++ Standard library. ... ... 17.3.3.1 Reserved names [lib.reserved.names] ... 17.3.3.1.1 Macro names [lib.macro.names] 1 Each name defined as a macro in a header is reserved to the implemen- tation for any use if the translation unit includes the header.21) 2 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 key- words.This breaks requirement 17.3.3.1.1 - 2 for using the C++ Standarnd Library.Code:#include <string> #define string wstring // search and replace broken :([EDIT]Code:#define private public #define basic_string my_basic_string #include <string>
Anyways, there's nothing that says a compiler shouldn't compile the above code.
Chapter 16 defines how a compiler should treat preprocessing directives.
[/EDIT]
gg
quotes not from the final draft standard
Last edited by Codeplug; 12-19-2003 at 09:42 PM.
Where did you get the Standard from? What is the cheapest legal way to obtain it?
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
You can buy the final standard at the ISO Store.
However the final draft is free, and you can find sites that sum up the changes/differences between the two.
You can download a PDF version here.
Online version.
You can also google ISO/IEC 14882 and find some other sources.
gg