Re: Parsing C++

fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
10 Dec 1996 12:11:12 -0500

          From comp.compilers

Related articles
[2 earlier articles]
Re: Parsing C++ nagle@netcom.com (1996-11-18)
Re: Parsing C++ jsgray@acm.org (Jan Gray) (1996-11-19)
Re: Parsing C++ jlilley@empathy.com (1996-12-03)
Re: Parsing C++ dlmoore@ix.netcom.com (David L Moore) (1996-12-07)
Re: Parsing C++ jlilley@empathy.com (1996-12-09)
Re: Parsing C++ jlilley@empathy.com (1996-12-09)
Re: Parsing C++ fjh@mundook.cs.mu.OZ.AU (1996-12-10)
Re: Parsing C++ davidb@datalytics.com (1996-12-18)
| List of all articles for this month |
From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
Newsgroups: comp.lang.c++.moderated,comp.compilers
Followup-To: comp.lang.c++.moderated
Date: 10 Dec 1996 12:11:12 -0500
Organization: Comp Sci, University of Melbourne
References: 96-11-102 96-12-029 96-12-052 96-12-072
Keywords: C++, parse
X-Original-Date: 10 Dec 1996 07:58:07 GMT

jlilley@empathy.com (John Lilley) writes:


>dlmoore@ix.netcom.com says...
>>One interesting thing about C++ is the "injection" rule which says that
>>a method defined in a class is compiled as if it immediately followed
>>the
>>class:
>>
>> int foo;
>> class A {
>> void bar()
>> {
>> foo x;
>> }
>> enum foo {bar,bletch};
>> };
>
>This is not entirely correct. You are not allowed to change the
>meaning of an identifier to a type after usage of the identifier has
>been encountered.


You're right that dlmoore@ix.netcom.com was not entirely correct:
you are not allowed to change the meaning of an identifier to a type
after a _declaration_ of the identifier has been encountered.
However, the current draft C++ standard allows code which uses type
names before those type names have been declared, so the meaning
of an identifier can change from "undeclared identifier" to "type name"
after the usage of that identifier.


--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.


            [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
            [ about comp.lang.c++.moderated. First time posters: do this! ]
--


Post a followup to this message

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