From 0db2b88c576aef2d5cd7e88a5e17cc648118481f Mon Sep 17 00:00:00 2001 From: bgloyer <36457894+bgloyer@users.noreply.github.com> Date: Thu, 7 Apr 2022 13:20:49 -0700 Subject: [PATCH] Added example for SF.21 (#1890) * Example for SF.21 * Update isocpp.dic * remove space * revert isocpp.dic change --- CppCoreGuidelines.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index 14f490f..7b02c0d 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -19558,7 +19558,26 @@ It is almost always a bug to mention an unnamed namespace in a header file. ##### 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