Page 1 of 1

[Code] Fix "using namespace" in headers

Posted: Tue May 24, 2011 1:17 pm
by alt_turo
Description: Some headers contain "using namespace" declarations. These should all be removed and the code fixed. Add using namespace to the source file or qualify the use itself with the namespace name. In particular "using namespace boost" is very wrong because boost is such a large namespace there are bound to be conflicts with something.

Why: This is ugly and can sometimes break stuff when two different namespaces contain symbols with the same name.

Difficulty: Easy

Timeline: At your leisure.

Special skills: Need to have access to at least one build environment and preferably several.

Re: [Code] Fix "using namespace" in headers

Posted: Tue May 24, 2011 4:58 pm
by chrisvarns
I'm game for this, but which is preferred, using namespace declarations in source, or fully qualifying? The latter may serve to make the code longwinded to read.

Re: [Code] Fix "using namespace" in headers

Posted: Wed May 25, 2011 12:10 pm
by alt_turo
chrisvarns wrote:which is preferred, using namespace declarations in source, or fully qualifying? The latter may serve to make the code longwinded to read.


Depends on the namespace. For std and boost I prefer fully qualifying so it's immediately apparent that they're not ours. For our namespaces I prefer using-declarations.

Re: [Code] Fix "using namespace" in headers

Posted: Wed May 25, 2011 4:21 pm
by chrisvarns
Sounds like a plan. Ill get started tonight unless someone else wants to do it?

Re: [Code] Fix "using namespace" in headers

Posted: Thu Jun 02, 2011 10:06 am
by dublindan
In general, I would prefer fully qualifying throughout, though I have nothing against alt_turos suggestion of qualifying only std/boost (I would generalize this as any external libs) and having using-declarations for all internal code.

I find the "long-windedness" is worthwhile for 1) ease of determining what the code in question belongs to and 2) avoiding name clashes.