From: Dan P. <ba...@al...> - 2005-11-22 00:10:27
|
On Nov 21, Sam Steele wrote: > In the header file or the cpp file? I was following Banner / Label > as an example, which use "using namespace" in the cpp file. My local > copy of the header uses "namespace Tiki {..." > > I've never worked with namespaces before, so it's all greek to me :) Apparently it's considered bad practice now to "using namespace" anywhere. You can probably guess from the Tiki code so far that I don't necessarily agree with that view. ;) My practice so far has been to try to minimize the impact that including any given header will have on other code. In general it seems like namespaces are something that are handled differently by each project. I guess some other practices I encouraged in the namespace setup are considered bad too, but whatever... For example I like the idea of having a mega Tiki namespace that has everything inside it, and then 'using namespace Tiki' and subsequently doing GL::Foo instead of Tiki::GL::Foo. Or for something that works extensively inside Tiki::GL, just "using namespace Tiki::GL" at the top of the cpp file. The big thing I think is to avoid doing anything like that in a header file. Also be very careful with 'using' decls inside a namespace or class, because that can have global effects. (Sorry if this sounds only moderately coherent.. listening to a work meeting too.. :) |