isocpp / isocpp/CppCoreGuidelines

NL.n Use namespaces, do nest your namespaces. Do not use a suffix or prefix in all defined names to provide scope.

Open
#497 23 comments 0 reactions 1 assignee View on GitHub

@BjarneStroustrup is already working on this.

Since Jun 19, 2017.

open
Dominant language
CSS
Stars
45.3k
Forks
5.6k
PR merge metrics
No merged PRs in 30d

Description

Reason:
Provides a narrow context where defined names are short, external names are well marked and also naturally segments your header-files, this makes larger code sets more easy to browse and comprehend and aids with refactoring.

Chances are your IDE provides a folding mechanism for namespaces, which is great when browsing these larger pieces of code.

Examples:

Alternatives:

Exceptions:
extern “C”

Enforcement:
Lint defined names and suggest shortening of long names, find repeated prefixes.

See also:

Notes:
Do not use reversed Internet domain names as namespaces, as java frequently do for package names.

Discussion:
Maybe GitHub could be persuaded to provide a global top-namespace allocatioin mechanism ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.