From 0466b1d82078d5833dd7f70c5c2bc7eeee535129 Mon Sep 17 00:00:00 2001 From: Sleep_AllDay <37238439+SpeedReach@users.noreply.github.com> Date: Sat, 30 Sep 2023 18:29:52 +0800 Subject: [PATCH] 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 --- CppCoreGuidelines.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index f96aa6311..7265f5b0b 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -11365,8 +11365,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 @@ -11378,9 +11376,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<1>(); //ok + string s2 = stringify<2>(); //does not compile // ... }