Article View: comp.std.c++
Article #1841Re: C++ Standard Libraries?
From: Steve Clamage
Date: Thu, 24 Aug 1995 21:52
Date: Thu, 24 Aug 1995 21:52
44 lines
2411 bytes
2411 bytes
Distribution: In article 72a@engnews2.Eng.Sun.COM, Wil Evers on Thu, Aug 24, 1995 9:26 AM writes: >In article <41d26q$4vv@engnews2.Eng.Sun.COM>, stephen.clamage@eng.sun.com (Steve >Clamage) wrote: > >> Thus, in portable code, you will be able to write for example >> #include <iostream> >> and you get the iostream declarations as required by the standard, >> no matter what the implementation provides as files or how it >> spells the file names. >> > >Here's a stupid newbie question about using the standard library C++ headers: >Does this mean I would still have to write `using namespace std' after the >`#include <iostream>', or is such a statement in the header itself? If so, how >can I include this header without importing its symbols directly into the >program? Not a stupid question at all, but one the committee has been wrestling with. If you use something like "#include <iostream>" (no suffix on the header name), you will get the iostream declarations in namespace "std". You can add your own "using namespace std;" if you want, which will bring the entire contents of the "std" namespace into scope (but just for those headers which you include). Implementations will be likely also to provide compatibility headers (perhaps e.g. <iostream.h>) which will include <iostream> followed by using-declarations for each item in the header. That will allow existing code to compile if they include the compatibility header. One early draft of the standard called out headers like those explicitly, but they have since been removed from the draft. (There still exist two versions of the C library headers, as I discussed in the original article.) --- Steve Clamage, stephen.clamage@eng.sun.com --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<MATT.95Aug24145217@physics2.Berkeley.EDU>Path:
arc1-ca.pugleaf.net!128.32.155.1!mattReferences:
<41i6nu$72a@engnews2.Eng.Sun.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt From: clamage@Eng.Sun.COM (Steve Clamage) Newsgroups: comp.std.c++ Subject: Re: C++ Standard Libraries? Date: 24 Aug 1995 21:52:17 GMT Organization: Sun Microsystems Inc. Approved: matt@physics2.Berkeley.EDU (Matt Austern) Message-ID: <MATT.95Aug24145217@physics2.Berkeley.EDU> References: <41i6nu$72a@engnews2.Eng.Sun.COM> Reply-To: clamage@Eng.Sun.COM NNTP-Posting-Host: physics2.berkeley.edu