public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* namespaces
@ 1997-11-29  5:43 Andrew Veliath
  1997-11-29 15:18 ` namespaces Andrew Veliath
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Veliath @ 1997-11-29  5:43 UTC (permalink / raw)
  To: egcs

Hi,

I'm a bit of a newbie here and with regards to egcs, so please bear
with me, I may have missed something.

I'm really interested in having ANSI C++ namespace support, so I've
been toying around with trying to fix the old broken implementation
which was commented out (also took out the temporary compatibility std
namespace).  I'm just looking for something that I can use on a
project that I want to rewrite in ANSI/ISO C++...

With some changes I made yesterday to egcs I can now compile the
following useless code (and it says "Hi", and it won't compile if not
given the correct scoping).  Putting a namespace std { } in iostream
works (I made an iostream file), but it won't link since I didn't
compile the library with that, since the names get mangled in
namespaces.

There are a few things I am not exactly sure how to do, since I'm not
readily familiar with gcc internals.  For one, I have not been able
yet to get data declarations in the namespaces to generate labled data
for some reason (I'm still trying though...:( ).

I'm going to try and implement "using" declarations and directives
soon, as well as namespace aliases, though I need to digest a bit
first.

#include <iostream.h>

namespace A {
  typedef char byte;
 
  namespace B {
    typedef char byte2;

    void f();
  }
}

namespace {
  void secret_code()
    {
    }
}

namespace A {
  namespace B {

    void f()
      {
	cout << "Hi" << endl;
	return 0;
      }
  }
}

int main(int, char *[])
{
  A::B::f();
  
  A::byte d = 0;
  A::B::byte2 e = 1;

  return 0;
}

--
Regards,
Andrew Veliath
veliaa@frontiernet.net, veliaa@rpi.edu

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

* Re: namespaces
  1997-11-29  5:43 namespaces Andrew Veliath
@ 1997-11-29 15:18 ` Andrew Veliath
  0 siblings, 0 replies; 8+ messages in thread
From: Andrew Veliath @ 1997-11-29 15:18 UTC (permalink / raw)
  To: egcs

    me>     void f() { cout << "Hi" << endl; return 0; } } }

:-O  sorry, the above was a cut and paste accident, I was supposed to
remove the return 0 before sending (it kinda looked bad :-)...

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

* Re: namespaces
  2002-04-25  2:54 namespaces eziolkow
  2002-04-25  2:56 ` namespaces Gerald Pfeifer
@ 2002-04-25  3:13 ` Paolo Carlini
  1 sibling, 0 replies; 8+ messages in thread
From: Paolo Carlini @ 2002-04-25  3:13 UTC (permalink / raw)
  To: eziolkow; +Cc: gcc

eziolkow@pit.edu.pl wrote:

>I have some problem with using  'map'' container from STL when I
>include  file '/usr/include/net/if.h' on
>SunOS 5.8 and with gcc 2.95.2 19991024 . That's because mentioned file
>contains another type called 'map'',  what conducts to the name
>conflict.
>
>When I investigated why 'std' namespace doesn't resolve this trouble, I
>discovered that for my compiler in
>file 'stl_config.h' is macro instruction (using __GNUC__ and
>__GNUC_MINOR__ macro definition),  which defines __STL_NO_NAMESPACES__.
>As a result, 'std' namespace does not exists.
>
>How are your suggestion to overcome this problem ?
>

My suggestion would be that of upgrading to gcc 3.0.4 or, in a few days, 
3.1.0, whose run time library is fully namespace aware.

Ciao, Paolo.



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

* Re: namespaces
  2002-04-25  2:54 namespaces eziolkow
@ 2002-04-25  2:56 ` Gerald Pfeifer
  2002-04-25  3:13 ` namespaces Paolo Carlini
  1 sibling, 0 replies; 8+ messages in thread
From: Gerald Pfeifer @ 2002-04-25  2:56 UTC (permalink / raw)
  To: eziolkow; +Cc: gcc

On Thu, 25 Apr 2002 eziolkow@pit.edu.pl wrote:
> I have some problem with using  'map'' container from STL when I
> include  file '/usr/include/net/if.h' on
> SunOS 5.8 and with gcc 2.95.2 19991024 .
> [...]
> How are your suggestion to overcome this problem ?

Have you tried GCC 3.0.4 already, which comes with a completely revamped
C++ standard library?

(In any case, at least you might want to upgrade to 2.95.3. We always
recommend the latest version of each release branch.)

Gerald
-- 
Gerald "Jerry" pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/

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

* namespaces
@ 2002-04-25  2:54 eziolkow
  2002-04-25  2:56 ` namespaces Gerald Pfeifer
  2002-04-25  3:13 ` namespaces Paolo Carlini
  0 siblings, 2 replies; 8+ messages in thread
From: eziolkow @ 2002-04-25  2:54 UTC (permalink / raw)
  To: gcc

I have some problem with using  'map'' container from STL when I
include  file '/usr/include/net/if.h' on
SunOS 5.8 and with gcc 2.95.2 19991024 . That's because mentioned file
contains another type called 'map'',  what conducts to the name
conflict.

When I investigated why 'std' namespace doesn't resolve this trouble, I
discovered that for my compiler in
file 'stl_config.h' is macro instruction (using __GNUC__ and
__GNUC_MINOR__ macro definition),  which defines __STL_NO_NAMESPACES__.
As a result, 'std' namespace does not exists.

How are your suggestion to overcome this problem ?

King regards,

                Eligiusz Ziolkowski


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

* namespaces
@ 1998-05-08 19:52 Mike Stump
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Stump @ 1998-05-08 19:52 UTC (permalink / raw)
  To: egcs

Great work:

Test Run By mrs on Fri May  8 13:58:26 1998
Native configuration is sparc-sun-solaris2.5.1
 
                === g++ tests ===
 
XPASS: g++.mike/ns11.C (test for excess errors)
XPASS: g++.mike/ns11.C  Execution test
XPASS: g++.mike/ns13.C (test for excess errors)
XPASS: g++.mike/ns14.C (test for excess errors)
XPASS: g++.mike/ns9.C (test for excess errors)
XPASS: g++.mike/ns9.C  Execution test
 
                === g++ Summary ===
 
# of expected passes            3819
# of unexpected successes       6
# of expected failures          67
# of untested testcases         6

Thanks!

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

* Re: namespaces
@ 1997-09-05 18:51 Mike Stump
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Stump @ 1997-09-05 18:51 UTC (permalink / raw)
  To: egcs, scottm

> From: scottm@cs.ucla.edu
> To: egcs@cygnus.com
> Date: Fri, 5 Sep 1997 18:40:41 -0700 (PDT)

> Before someone says, "Why don't you work on it?", can I ask the
> simply obvious: What's the state of affairs of namespaces?

They don't work.  That is the state.  There is support in the parser
for all the syntax, and there are some functions relating to
namespaces in the compiler now, but it is reasonable to rip them all
out, and start from scratch.  There are some tough choices to make,
how much memory to burn v how slow do you want the compiler...

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

* namespaces
@ 1997-09-05 18:40 scottm
  0 siblings, 0 replies; 8+ messages in thread
From: scottm @ 1997-09-05 18:40 UTC (permalink / raw)
  To: egcs

Before someone says, "Why don't you work on it?", can I ask the
simply obvious: What's the state of affairs of namespaces?

(He says just before looking at the source...)


-scooter

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

end of thread, other threads:[~2002-04-25  9:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-29  5:43 namespaces Andrew Veliath
1997-11-29 15:18 ` namespaces Andrew Veliath
  -- strict thread matches above, loose matches on Subject: below --
2002-04-25  2:54 namespaces eziolkow
2002-04-25  2:56 ` namespaces Gerald Pfeifer
2002-04-25  3:13 ` namespaces Paolo Carlini
1998-05-08 19:52 namespaces Mike Stump
1997-09-05 18:51 namespaces Mike Stump
1997-09-05 18:40 namespaces scottm

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).