P
Pep
Howard said:I don't find it particularly inconvient to type the extra characters for
things lke std::cout, so most of the time I just type it out.
But if I'm working with other developers, I'll often put using statements
(such as "using std::cout;") at the top of a given function. That way,
the using statements for that function are right there at the entry to the
function, where other developers can immediately see what the following
code
is referring to. (Which is good self-documentation!)
-Howard
Agreed that this is a reasonable approach that I have adopted in the past
but I think my problems with the namespaces are that I invariably get
drafted in to radically upgrade and support really bad legacy code which
has routines that extend to over 1,000 lines of code in one single method,
I kid you not!
The current project I am maintaining has hundreds of routines like this,
sometimes multiple > 1,000 lines of code per method in one source file!
So at this point you can forgive developers for not noticing anything at the
top of the routine, which in this case I suppose the only safe option is to
either
use the namespace std:: prefix to all enclosed routines
or
insist that std:: namespace is the default for the project and that any
routines, templates or classes used from other namespaces that override the
std:: namespace must be prefixed with the namespace tag
I guess this is going to become one of those legacy support issues when c++
is advanced to something new