This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: std namespace no longer assumed?
- From: John Love-Jensen <eljay at adobe dot com>
- To: Sean Hayden <Sean dot Hayden at billingconcepts dot com>, "'gcc_help at gcc dot gnu dot org'" <gcc-help at gcc dot gnu dot org>
- Date: Tue, 10 Jun 2003 06:50:45 -0500
- Subject: Re: std namespace no longer assumed?
Hi Sean,
> Is there a compiler switch to work around having to add:
> using namespace std;
> to all my source files?
I hope not! Otherwise, some programmers may be tempted to make
non-compliant C++.
(And it appears that there isn't a GCC compiler switch to do that, anyway.)
Also, I recommend you do NOT add "using namespace std;" everywhere.
Instead, do things like "using std::cout;", where you pull into your source
code's namespace exactly (and conscientiously) the things that you are
utilizing.
For example:
#include <iostream>
using std::cout;
using std::cerr;
using std::endl;
#include <string>
using std::string;
--Eljay