Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the style guide to outline how namespaces should be used #225

Open
adlarkin opened this issue Jan 4, 2022 · 3 comments
Open

Update the style guide to outline how namespaces should be used #225

adlarkin opened this issue Jan 4, 2022 · 3 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@adlarkin
Copy link
Contributor

adlarkin commented Jan 4, 2022

Desired behavior

We currently do not have any rules/guidelines on how namespaces should be used. This could result in naming collisions between various projects. We should outline dos and don'ts of namespace usage for ignition projects.

Alternatives considered

N/A (new feature)

Implementation suggestion

Add a section to https://ignitionrobotics.org/docs/all/contributing#style-guides that outlines how namespaces should be included/used. Some guidelines were discussed in this thread: gazebosim/gz-sensors#177 (comment)

Additional context

The original conversation for this was started in gazebosim/gz-sensors#177 (comment)

@adlarkin adlarkin added the enhancement New feature or request label Jan 4, 2022
@adlarkin adlarkin added documentation Improvements or additions to documentation help wanted Extra attention is needed and removed help wanted Extra attention is needed labels Jan 4, 2022
@scpeters
Copy link
Member

scpeters commented Feb 1, 2022

I think it would be helpful to generally follow the cppcore guidelines, specifically SF 6 & 7

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#sf6-use-using-namespace-directives-for-transition-for-foundation-libraries-such-as-std-or-within-a-local-scope-only

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#sf7-dont-write-using-namespace-at-global-scope-in-a-header-file

that makes sense, both avoiding using namespace statements at global scope in a header file and preferring local scope when possible

I don't know if there are any linters that can detect this

@mjcarroll
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants