adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-devel] using namespace std;


From: Lakin Wecker
Subject: [Adonthell-devel] using namespace std;
Date: Tue, 04 Dec 2001 18:24:41 -0700

I was browsing through the code base, and came upon "using namespace std;" in 
a few header files, so I grepped for it, and there seems to be about 10-15 
headers that do that.

This is a small point however:  It's considered bad form to use "using 
namespace <blah>;" in a header file, because it then introduces all of the 
functions, variables, and classes of that namespace into global namespace.  
Which not only defeats the purpose of namespace's it clutters the global 
namespace.  

Consider doing one of the following things.

1) the best solution would be to append std::<blah> to everything that needs 
it in both the header and implementation file.   However  "using namespace 
std;" in the source file,  isn't too bad. Because it's only that file which 
has the polluted namespace.

2) put "using namespace std::cout;" or "using namespace std:iostream;".  
however this is just less of the same bad form.  It only pollutes the global 
namespace with those two ... etc....

Just a small thought, and general programming style suggestion.

Lakin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]