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

Code style: Do not indent namespace #2917

Open
glebm opened this issue Jun 19, 2019 · 2 comments
Open

Code style: Do not indent namespace #2917

glebm opened this issue Jun 19, 2019 · 2 comments

Comments

@glebm
Copy link
Contributor

glebm commented Jun 19, 2019

Indenting the contents of namespace { ... } is rather uncommon.
Can we stop doing this in all new code?

Examples:

GCC Coding Conventions, https://gcc.gnu.org/codingconventions.html#Namespace_Form:

Definitions within the body of a namespace are not indented.

LLVM Coding Standards, https://llvm.org/docs/CodingStandards.html#namespace-indentation:

In general, we strive to reduce indentation wherever possible. [...] To facilitate this and avoid some insanely deep nesting on occasion, don’t indent namespaces.

Google C++ Style Guide, https://google.github.io/styleguide/cppguide.html#Namespace_Formatting:

The contents of namespaces are not indented.


On a more general note, can we simply configure clang-format and use it for all the code to get consistent formatting?

Humans are pretty bad at consistent formatting. Currently the formatting is all over the place, making code hard to read. Using clang-format will free us from having to worry about formatting at all.

We can use the Google C++ clang-format style (which IMO is pretty good).
We can configure clang-format and run it on all existing code, now that there are no huge outstanding PRs.

@mgreter @xzyfer

@xzyfer
Copy link
Contributor

xzyfer commented Jun 19, 2019 via email

@nschonni
Copy link
Collaborator

I took a shot at clang-format in #2324, but my cpp is pretty limited, so I've got no strong opinions on what style to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants