From: | fjh@mundook.cs.mu.OZ.AU (Fergus Henderson) |
Newsgroups: | comp.compilers |
Date: | 27 Aug 1996 23:50:02 -0400 |
Organization: | Comp Sci, University of Melbourne |
References: | <96-08-058@comp.compilers 96-08-070 96-08-085 |
Keywords: | parse, C++ |
itz@rahul.net (Ian T Zimmerman) writes:
>Jerry Leichter <leichter@smarts.com> writes:
>
>> With modern languages, much of the semantics of the language is not
>> in the statements themselves, but in the libraries. [...]
>> However, no one
>> proposes that the names of library classes, much less their members
>> be reserved! If it's so important to reserve the keywords, why not
>> the library names?
>
>Actually, AFAIK, the C++ draft standard says that reusing names from the std
>namespace leads to undefined behaviour.
That's not correct. The only names which are reserved *for any use* are
those starting with two underscores or an underscore and an uppercase
letter, and macro names (and then only if the header defining the macro
is #included). The other names are only reserved for particular uses;
there is nothing wrong with declaring a local variable called `malloc',
for instance.
>You _are_ supposed to know the whole standard library if you use the language.
No, you only need know the macro names. Backwards compatibility
considerations mean that there are some possible conflicts with global
names and names with external linkage, but you ought to be able to
avoid worrying about those by putting your code in its own namespace.
The C++ standard library does not define any macros other than the
macros defined in the C standard library, I believe. There are more
keywords (68) to worry about than macros (54).
--
Fergus Henderson <fjh@cs.mu.oz.au>
WWW: <http://www.cs.mu.oz.au/~fjh>
PGP: finger fjh@128.250.37.3
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.