[Code] Fix "using namespace" in headers

Tasks for the Jack Claw project.
alt_turo
Posts: 195
Joined: Mon Dec 13, 2010 11:06 am

[Code] Fix "using namespace" in headers

Postby alt_turo » Tue May 24, 2011 1:17 pm

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.
Turo Lamminen
Alternative Games

chrisvarns
Posts: 5
Joined: Tue May 24, 2011 4:25 pm

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

Postby chrisvarns » Tue May 24, 2011 4:58 pm

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.

alt_turo
Posts: 195
Joined: Mon Dec 13, 2010 11:06 am

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

Postby alt_turo » Wed May 25, 2011 12:10 pm

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.
Turo Lamminen
Alternative Games

chrisvarns
Posts: 5
Joined: Tue May 24, 2011 4:25 pm

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

Postby chrisvarns » Wed May 25, 2011 4:21 pm

Sounds like a plan. Ill get started tonight unless someone else wants to do it?

dublindan
Posts: 8
Joined: Wed Apr 20, 2011 6:16 am

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

Postby dublindan » Thu Jun 02, 2011 10:06 am

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.


Return to “Jack Claw tasks”

Who is online

Users browsing this forum: No registered users and 6 guests