Merge lp://staging/~p12/kicad/remove-uses-namespace-std into lp://staging/kicad/product

Proposed by Povilas Kanapickas
Status: Merged
Merge reported by: Dick Hollenbeck
Merged at revision: not available
Proposed branch: lp://staging/~p12/kicad/remove-uses-namespace-std
Merge into: lp://staging/kicad/product
Diff against target: 1780 lines (+184/-244)
47 files modified
CMakeModules/PerformFeatureChecks.cmake (+1/-1)
common/geometry/shape_line_chain.cpp (+4/-5)
common/gr_basic.cpp (+2/-2)
common/tool/tool_event.cpp (+1/-3)
common/tool/tool_manager.cpp (+0/-1)
eeschema/annotate.cpp (+1/-2)
eeschema/component_references_lister.cpp (+1/-1)
eeschema/hierarch.cpp (+1/-1)
eeschema/sch_bus_entry.cpp (+1/-1)
eeschema/sch_bus_entry.h (+1/-1)
eeschema/sch_component.cpp (+2/-2)
eeschema/sch_component.h (+2/-2)
eeschema/sch_junction.cpp (+1/-1)
eeschema/sch_junction.h (+1/-1)
eeschema/sch_line.cpp (+1/-1)
eeschema/sch_line.h (+3/-3)
eeschema/sch_no_connect.cpp (+1/-1)
eeschema/sch_no_connect.h (+1/-1)
eeschema/sch_sheet.cpp (+1/-1)
eeschema/sch_sheet.h (+1/-1)
eeschema/sch_text.cpp (+1/-1)
eeschema/sch_text.h (+1/-1)
include/sch_item_struct.h (+4/-7)
include/tool/examples/coroutine_example.cpp (+0/-2)
include/tool/examples/delegate_example.cpp (+0/-2)
kicad/dialogs/dialog_template_selector.h (+1/-1)
kicad/project_template.cpp (+4/-6)
kicad/project_template.h (+1/-4)
new/sch_dir_lib_source.cpp (+0/-3)
new/sch_lib_table.cpp (+0/-1)
pcbnew/eagle_plugin.cpp (+64/-65)
pcbnew/github/github_plugin.cpp (+13/-18)
pcbnew/gpcb_plugin.cpp (+8/-11)
pcbnew/kicad_plugin.cpp (+1/-4)
pcbnew/legacy_plugin.cpp (+13/-16)
pcbnew/pcb_parser.cpp (+13/-17)
pcbnew/router/pns_line.cpp (+2/-3)
pcbnew/router/pns_line_placer.cpp (+1/-3)
pcbnew/router/pns_node.cpp (+7/-9)
pcbnew/router/pns_optimizer.cpp (+3/-5)
pcbnew/router/pns_router.cpp (+5/-7)
pcbnew/router/pns_shove.cpp (+2/-4)
pcbnew/router/pns_walkaround.cpp (+0/-4)
pcbnew/router/router_tool.cpp (+0/-1)
polygon/SutherlandHodgmanClipPoly.h (+7/-8)
polygon/poly2tri/common/shapes.cc (+6/-7)
scripting/kicad.i (+0/-2)
To merge this branch: bzr merge lp://staging/~p12/kicad/remove-uses-namespace-std
Reviewer Review Type Date Requested Status
KiCad Lead Developers Pending
Review via email: mp+197657@code.staging.launchpad.net

Description of the change

Remove uses of using namespace std.

To post a comment you must log in.
Revision history for this message
Dick Hollenbeck (dickelbeck) wrote :

I wish we had added this text to the coding standards:

**************************

  The project should never use 'using namespace ...' in a header file, but using
  it in a *.cpp file is OK, according to the author of the *.cpp file's preference.
  If it occurs in a *.cpp file, it must occur after any #include statements.

**************************

The consequences of that make it impossible not to use std:: for all STL objects which
present themselves in a header file. This is the public API.

The above policy also gives the implementation author the freedom of brevity in a file which is not affecting usage of the API in (client callaing) *.cpp files.

I personally have followed this policy in everything I've contributed, never once put a "using namespace" into a header file. I was not aware that we had strayed from this common sense approach.

So I only like about 25% of this patch, because for my *.cpp files, I really don't care to see them be changed in a way other than I wrote them for something other than a bug. Of course, this is an understatement.

It is general, not limited to me. It is respectful of the original author's wishes, the person who we often call upon to *support* the code when something goes wrong.

Revision history for this message
Dick Hollenbeck (dickelbeck) wrote :

The negotiated result was that we are to add these lines to the Coding Standards document:

  The project should never use 'using namespace ...' in a header file, but using
  it in a *.cpp file is OK, according to the author of the *.cpp file's preference.
  If it occurs in a *.cpp file, it must occur after any #include statements.

(Wayne agreed to do that.)

Then I consulted authors/developers who have made use of 'using namespace' in *.cpp files, which is still legal, to find out what they were willing to give up. The applied patch is a result of this process, and it is a subset of the original request.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.