From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Veliath To: egcs@cygnus.com Subject: namespaces Date: Sat, 29 Nov 1997 05:43:00 -0000 Message-id: <199711291251.HAA07595@jupiter.velsoft.com> X-SW-Source: 1997-11/msg00952.html 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 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