public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [Re: Problem with the EGCS cpp? < 3.0.6.32.19990218000955.00877370@pop.netaddress.com > ]
@ 1999-02-18  6:37 Paul Derbyshire
  1999-02-20 17:32 ` Alexandre Oliva
  1999-02-28 22:53 ` Paul Derbyshire
  0 siblings, 2 replies; 4+ messages in thread
From: Paul Derbyshire @ 1999-02-18  6:37 UTC (permalink / raw)
  To: egcs

>I'm surprised the scope resolution operator :: does not allow
>whitespace on either side, since it is grammatically an operator, not
>part of an identifier.  This might be a bug in the C++ front end.  Or
>I might be demonstrating once again that I know squat about C++.

It looks as if the frontend uses whitespace to disambiguate

namespace Foo { int bar2; }

struct Foo { ... }

void func (void) {
  Foo ::bar1;
  Foo::bar2 = 3;
}


The best workaround I can come up with is

#ifdef HAVE_NAMESPACES
#define SCOPED(space, symbol) space##::##symbol
#else
#define SCOPED(space, symbol) ::##symbol
#endif

Bletcherous, but I guess it'll have to do =(

Any idea how soon namespaces will be widely supported?


____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com/?N=1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Re: Problem with the EGCS cpp? < 3.0.6.32.19990218000955.00877370@pop.netaddress.com > ]
  1999-02-18  6:37 [Re: Problem with the EGCS cpp? < 3.0.6.32.19990218000955.00877370@pop.netaddress.com > ] Paul Derbyshire
@ 1999-02-20 17:32 ` Alexandre Oliva
  1999-02-28 22:53   ` Alexandre Oliva
  1999-02-28 22:53 ` Paul Derbyshire
  1 sibling, 1 reply; 4+ messages in thread
From: Alexandre Oliva @ 1999-02-20 17:32 UTC (permalink / raw)
  To: Paul Derbyshire; +Cc: egcs

On Feb 18, 1999, Paul Derbyshire <pderbysh@usa.net> wrote:

> It looks as if the frontend uses whitespace to disambiguate

> namespace Foo { int bar2; }
> struct Foo { ... }
> void func (void) { Foo ::bar1; Foo::bar2 = 3; }

The latest snapshot says:

t.cc: In function `void func()':
t.cc:6: `bar1' is not a member of type `Foo'
t.cc:7: `bar2' is not a member of type `Foo'

So there's no disambiguation taking place here.

-- 
Alexandre Oliva  http://www.dcc.unicamp.br/~oliva  aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Re: Problem with the EGCS cpp? < 3.0.6.32.19990218000955.00877370@pop.netaddress.com > ]
  1999-02-20 17:32 ` Alexandre Oliva
@ 1999-02-28 22:53   ` Alexandre Oliva
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 1999-02-28 22:53 UTC (permalink / raw)
  To: Paul Derbyshire; +Cc: egcs

On Feb 18, 1999, Paul Derbyshire <pderbysh@usa.net> wrote:

> It looks as if the frontend uses whitespace to disambiguate

> namespace Foo { int bar2; }
> struct Foo { ... }
> void func (void) { Foo ::bar1; Foo::bar2 = 3; }

The latest snapshot says:

t.cc: In function `void func()':
t.cc:6: `bar1' is not a member of type `Foo'
t.cc:7: `bar2' is not a member of type `Foo'

So there's no disambiguation taking place here.

-- 
Alexandre Oliva  http://www.dcc.unicamp.br/~oliva  aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Re: Problem with the EGCS cpp? < 3.0.6.32.19990218000955.00877370@pop.netaddress.com > ]
  1999-02-18  6:37 [Re: Problem with the EGCS cpp? < 3.0.6.32.19990218000955.00877370@pop.netaddress.com > ] Paul Derbyshire
  1999-02-20 17:32 ` Alexandre Oliva
@ 1999-02-28 22:53 ` Paul Derbyshire
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Derbyshire @ 1999-02-28 22:53 UTC (permalink / raw)
  To: egcs

>I'm surprised the scope resolution operator :: does not allow
>whitespace on either side, since it is grammatically an operator, not
>part of an identifier.  This might be a bug in the C++ front end.  Or
>I might be demonstrating once again that I know squat about C++.

It looks as if the frontend uses whitespace to disambiguate

namespace Foo { int bar2; }

struct Foo { ... }

void func (void) {
  Foo ::bar1;
  Foo::bar2 = 3;
}


The best workaround I can come up with is

#ifdef HAVE_NAMESPACES
#define SCOPED(space, symbol) space##::##symbol
#else
#define SCOPED(space, symbol) ::##symbol
#endif

Bletcherous, but I guess it'll have to do =(

Any idea how soon namespaces will be widely supported?


____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com/?N=1

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-02-28 22:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-18  6:37 [Re: Problem with the EGCS cpp? < 3.0.6.32.19990218000955.00877370@pop.netaddress.com > ] Paul Derbyshire
1999-02-20 17:32 ` Alexandre Oliva
1999-02-28 22:53   ` Alexandre Oliva
1999-02-28 22:53 ` Paul Derbyshire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).