google / google/styleguide

C++: Unclear wording around using-directive

Open
#844 1 comment 0 reactions 0 assignees View on GitHub
lang:cpp
Dominant language
HTML
Stars
39.6k
Forks
12.9k
Avg merge
42m
Merged PRs (30d)
15

Description

In the _Namespaces_ section:

> With few exceptions, place code in a namespace. Namespaces should have unique names based on the project name, and possibly its path. Do not use using-directives (e.g., using namespace foo). Do not use inline namespaces. For unnamed namespaces, see Internal Linkage.

This wording gives the impression that the `using` keyword should never be used. However, that would be in direct conflict with an example given later in the section (`using ::foo::Bar;`). [This comment](https://github.com/google/styleguide/pull/204#issuecomment-265744834) by @tituswinters provides a possible explanation, suggesting it is just a bit of unusual terminology:

> Using directives are of the form "using namespace blah;"
> Using declarations are of the form "using myproject::some_symbol;"

I think the wording could be made more clear, for example `Do not use using namespace directives`, if that is the intended meaning.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.