diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index da6c780..f85e3bb 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -6513,11 +6513,11 @@ The alternative is to make two failure states compare equal and any valid state ##### Note -This rule applies to all the usual comparison operators: `!=`, `<`, `<=`, `>`, and `>=`. +This rule applies to all the usual comparison operators: `!=`, `<`, `<=`, `>`, `>=`, and `<=>`. ##### Enforcement -* Flag an `operator==()` for which the argument types differ; same for other comparison operators: `!=`, `<`, `<=`, `>`, and `>=`. +* Flag an `operator==()` for which the argument types differ; same for other comparison operators: `!=`, `<`, `<=`, `>`, `>=`, and `<=>`. * Flag member `operator==()`s; same for other comparison operators: `!=`, `<`, `<=`, `>`, and `>=`. ### C.87: Beware of `==` on base classes @@ -6562,11 +6562,11 @@ Of course there are ways of making `==` work in a hierarchy, but the naive appro ##### Note -This rule applies to all the usual comparison operators: `!=`, `<`, `<=`, `>`, `>=`, and `<=>`. +This rule applies to all the usual comparison operators: `!=`, `<`, `<=`, `>`, and `>=`. ##### Enforcement -* Flag a virtual `operator==()`; same for other comparison operators: `!=`, `<`, `<=`, `>`, `>=`, and `<=>`. +* Flag a virtual `operator==()`; same for other comparison operators: `!=`, `<`, `<=`, `>`, and `>=`. ### C.89: Make a `hash` `noexcept` @@ -19414,6 +19414,22 @@ It is almost always a bug to mention an unnamed namespace in a header file. Nothing external can depend on an entity in a nested unnamed namespace. Consider putting every definition in an implementation source file in an unnamed namespace unless that is defining an "external/exported" entity. +##### Example; bad + + static int f(); + int g(); + static bool h(); + int k(); + +##### Example; good + + namespace { + int f(); + bool h(); + } + int g(); + int k(); + ##### Example An API class and its members can't live in an unnamed namespace; but any "helper" class or function that is defined in an implementation source file should be at an unnamed namespace scope.