This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: STL headers problem
- To: ncm at cygnus dot com (Nathan Myers)
- Subject: Re: STL headers problem
- From: Joe Buck <jbuck at synopsys dot com>
- Date: Thu, 30 Jul 98 7:53:59 PDT
- Cc: egcs at cygnus dot com
I wrote:
> > Actually, if the program says
> >
> > #include <vector>
> > using namespace std;
> >
> > it will work before and after the conversion (since std is currently a
> > "dummy") and even be portable (however, the user will have to avoid
> > using any of the names in the std namespace).
Nathan writes:
> This is really rolling out the big guns. For vector,
>
> #include <vector>
> using std::vector;
>
> has the same useful effect without the smoke and carnage.
Yes, Nathan's style is preferable as a rule. However, 'using namespace std;'
corresponds pretty much exactly the the current state of affairs
(since all of the library is already in the global namespace). If
it breaks any program (because it imports too many names), that program
is already broken on egcs-1.1. Hence my message is correct in what it
says.
Explicit using std::foo directives are better for new code. But
'using namespace std;' may be the best thing for some other purposes,
like making our old tests still valid when -fhonor-std becomes the
default.