Skip to content

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

Open
@SimonTemplate

Description

@SimonTemplate

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 ?

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions