Re: How to parse keywords that can be used as identifiers?

fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
27 Aug 1996 23:50:02 -0400

          From comp.compilers

Related articles
[4 earlier articles]
Re: How to parse keywords that can be used as identifiers? ph@anweald.exnet.co.uk (1996-08-24)
Re: How to parse keywords that can be used as identifiers? grosch@cocolab.sub.com (1996-08-24)
Re: How to parse keywords that can be used as identifiers? dlmoore@ix.netcom.com (David L Moore) (1996-08-24)
Re: How to parse keywords that can be used as identifiers? itz@rahul.net (1996-08-24)
Re: How to parse keywords that can be used as identifiers? peter@bj-ig.de (Peter Brueckner) (1996-08-27)
Re: How to parse keywords that can be used as identifiers? stefan.monnier@lia.di.epfl.ch (Stefan Monnier) (1996-08-27)
Re: How to parse keywords that can be used as identifiers? fjh@mundook.cs.mu.OZ.AU (1996-08-27)
Re: How to parse keywords that can be used as identifiers? iwm@doc.ic.ac.uk (Ian Moor) (1996-09-03)
Re: How to parse keywords that can be used as identifiers? ok@cs.rmit.edu.au (1996-09-05)
Re: How to parse keywords that can be used as identifiers? jpff@maths.bath.ac.uk (1996-09-05)
| List of all articles for this month |
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
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.