I was going to add to this , but decided against hijacking his threadAnd yes, I read the link that someone posted -- good info but doesn't clarify my question.
Originally Posted by valis
I've read several programmers say that, but nobody has ever given a good explaination why it is bad. Well, so it gives the program unlimited assess to the namespace. So what? That's exactly what I want anyway. When I include header files I expect to be able to use the objects defined therein. And I've not yet seen a compiler run out of memory because I used the "using namespace std;" globally. And it doesn't significantly (if at all) increase compile time. Nor does it may the final executable program size any bigger, unless the compiler has a really crappy linker!
There are only two really good reasons I can think of for NOT using "using namespace <namespace>"
1. clarity. using the <namespace>::<object> syntax always makes it perectly clear and obvious where <object> is defined, or which namespace it is defined in.
2. when an object with the same name is declared in two or more namespaces. compiler would probably generate ambigious declaration errors without using <namespace>::<object> syntax.
Can anyone else list any other good reasons -- "its not good programming practice" is a really lousy copout.



LinkBack URL
About LinkBacks
And yes, I read the link that someone posted -- good info but doesn't clarify my question.


