mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-15 21:38:10 +00:00
Note namespace and static recommendations in C++ style guide (#1041)
This commit is contained in:
1 parent
086834d63a
commit
eda43faa5a
16 files changed
+48
-49
No files matched your search
@@ -141,6 +141,15 @@ these.
|
||||
necessary to create a scope for a variable.
|
||||
- Always break the line immediately after an open brace except for empty
|
||||
loop bodies.
|
||||
- For
|
||||
[internal linkage](https://google.github.io/styleguide/cppguide.html#Internal_Linkage)
|
||||
of definitions of functions and variables, prefer `static` over anonymous
|
||||
namespaces. `static` minimizes the context necessary to notice the internal
|
||||
linkage of a definition.
|
||||
- Anonymous namespaces are still necessary for classes and enums.
|
||||
- Tests are an exception and should typically be wrapped with
|
||||
`namespace Carbon::Testing { namespace { ... } }` to keep everything
|
||||
internal.
|
||||
|
||||
### Copyable and movable types
|
||||
|
||||
|
||||
Reference in new issue
Block a user