This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: STL headers problem


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.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]