public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Veliath <veliaa@frontiernet.net>
To: egcs@cygnus.com
Subject: namespaces
Date: Sat, 29 Nov 1997 05:43:00 -0000	[thread overview]
Message-ID: <199711291251.HAA07595@jupiter.velsoft.com> (raw)

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

             reply	other threads:[~1997-11-29  5:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-29  5:43 Andrew Veliath [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199711291251.HAA07595@jupiter.velsoft.com \
    --to=veliaa@frontiernet.net \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).