From 1bdb43e5c77ba381d7fae7c39519e8a688e56c89 Mon Sep 17 00:00:00 2001 From: Sleep_AllDay <37238439+SpeedReach@users.noreply.github.com> Date: Fri, 13 Oct 2023 05:02:51 +0800 Subject: [PATCH] ES.30 fix example code (#2143) * ES.30 fix example code The example should be passing in a constexpr and validating it at compile time like a macro, but instead passes a unknown value at compile time. Which may cause mislead and the code doesn't even work. Ref: #2136 * Update CppCoreGuidelines.md Used enums instead of raw numbers. --- CppCoreGuidelines.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index 4a2b6e1..13e4a32 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -11368,8 +11368,6 @@ Also, `#` and `##` encourages the definition and use of macros: There are workarounds for low-level string manipulation using macros. For example: - string s = "asdf" "lkjh"; // ordinary string literal concatenation - enum E { a, b }; template @@ -11381,9 +11379,10 @@ There are workarounds for low-level string manipulation using macros. For exampl } } - void f(int x, int y) + void f() { - string sx = stringify(); + string s1 = stringify(); + string s2 = stringify(); // ... }