From: khan AT xraylith DOT wisc DOT edu (Mumit Khan) Subject: Re: Namespace support? 29 Sep 1998 17:43:35 -0700 Message-ID: <9809290314.AA07226.cygnus.gnu-win32@modi.xraylith.wisc.edu> References: <199809280608 DOT BAA30613 AT daleth DOT grace DOT edu> To: "MISTY D LINVILLE" Cc: gnu-win32 AT cygnus DOT com "MISTY D LINVILLE" writes: > Hi! I'm a new C++ student, and I'd rather not use a commercial > compiler at this point, since I'm poor. :) I'm interested in > Cygnus-win32, but I have some questions. First, will the compiler > balk if I remove the .h from all the header files? (the prof likes it > this way, since it's the new VC++ standard), and secondly, will the > line 'using namespace std;' compile cleanly, in this compiler? I'm > not even entirely sure what this line is for, but it's in every > example in the book, and VC++5 compiles it beautifully, but VC++ 4 > doesn't, nor does djgpp. I find that if I leave out that line and > say instead of just
, it compiles fine, but the > prof doesn't like it. I'd appreciate any help! Misty, The latest GNU C++ released as part of egcs-1.1 does support namespaces, but with a few caveats -- - the "using" directive is not quite standard. It uses ARM style lookup instead of the new kind. The following fails for example: struct A { void f(int); }; struct B : A { using A::f; void f(long); }; - the C++ runtime library still lags behind the standard quite a bit. KAI and MSVC are the only two that I have access to that comes with standard ones, even though the one for MSVC is somewhat crippled to compensate for compiler limitations. The biggest side-effect of the lack of standard runtime library for GNU C++ is that all the symbols in dumped into global namespace, not in std. However, ``using namespace std'' works just fine. I have just a few #ifdefs in my code when egcs C++ became featureful enough to build it (we normally use EDG based compilers on both Unix and win32), and I'm hoping to get rid of those pretty soon. And, no, MSVC 5/6 can't even grok most of this code thanks to lousy template handling. EGCS-1.1 is the first release with namespace support, so quite a few rough edges remain. With the new standard C++ library in the works, and egcs improving namespace support, we can look forward to a much better compiler in the future. Your prof is correct that using
is definitely better style than using the corresponding .h file due to proper scoping. However, your prof is quite incorrect that VC++ *defines* any "standard"; in fact, MSVC is not even that good at *following* the standard ;-) Note that you can't just remove the .h, since the C-style headers are wrapped with a "c" in front, eg., --> . I suggest you try it out and see for yourself. I also suggest that you take a quick look (and ask your prof to do the same!) at egcs-1.1. You can get more info at . Regards, Mumit - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".