[EMAIL PROTECTED] wrote:
> [...]
>> .. (which is why most C++ books
>> recommend against "using" in application code...)
> 
> Can you cite some examples?  Personally I know of no authors
> who recommend against "using" in application code, but then
> again I haven't read a C++ book for a number of years.

I'd have to go digging (I also haven't read a C++ book in a while)
but the jist of it is that "using" only works well for a single
namespace which can make it difficult to know which version of
class "Widget" you are using in a particular source file, e.g.:

     using namespace foo;

     Widget a;
     ::Widget b;
     ::bar::Widget c;

Namespaces don't work any better than prefixes for preventing
collisions, and they can also cause more collisions depending on
how functions and classes are named.

Think of FLTK's single-letter h(), w(), x(), and y() functions -
in FLTK 1.x we put these in the Fl class, while in FLTK 2.x they
are moved to the fltk namespace and thus will cause complications
for any code with "using namespace foo".  At least with the 1.x
implementation the problem is limited to the Fl class methods.

> Perhaps you're thinking of the recommondation to avoid "using"
> in header files?

No, that is another case where you just don't want to do it.

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to