mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 04:44:34 +03:00
Added example for SF.21 (#1890)
* Example for SF.21 * Update isocpp.dic * remove space * revert isocpp.dic change
This commit is contained in:
@@ -19558,7 +19558,26 @@ It is almost always a bug to mention an unnamed namespace in a header file.
|
|||||||
|
|
||||||
##### Example
|
##### Example
|
||||||
|
|
||||||
???
|
// file foo.h:
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
const double x = 1.234; // bad
|
||||||
|
|
||||||
|
double foo(double y) // bad
|
||||||
|
{
|
||||||
|
return y + x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Foo
|
||||||
|
{
|
||||||
|
inline constexpr double x = 1.234; // good
|
||||||
|
|
||||||
|
inline double foo(double y) // good
|
||||||
|
{
|
||||||
|
return y + x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
##### Enforcement
|
##### Enforcement
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user