arnuld <sun...@invalid.address> wrote in
news:54a8cfd2$0$284$
1472...@news.sunsite.dk:
First I admit I haven't read the Stroustrup's text, just sharing my
opinion about 'using namespace'.
Like everything else in programming, some style decision is not the goal.
The goal is to get something done, which in case of C++ often means
writing software which is maintainable over long time. Software is
maintainable if it is concsise, gives enough detail and does not involve
too many distractions. The namespace prefixes are both the detail and the
distraction, so one has to find some good balance when using them.
IMO, the one-two namespaces which are used heavily in the code could be
used without prefixes to reduce distraction and verbosity, and all other
namespaces should be spelled out for providing the detail. In my code the
heavily used namespaces are my own ones, so std:: is always spelled out,
but I gather it may be different in some other code and 'using namespace
std;' could be a good idea in some code (like in example code
demonstrating the use of standard library).
That said, 'using namespace' should never appear in a header file, to not
force its decision about the balance upon other source code files.
hth
Paavo