Skip to content

C++: Unclear wording around using-directive #844

Open
@mcejp

Description

@mcejp

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 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 <i>using namespace</i> directives, if that is the intended meaning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:cppThe C++ language

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions