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.
pull/2156/head
Sleep_AllDay 2 years ago committed by GitHub
parent 56e5b42eee
commit 1bdb43e5c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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: There are workarounds for low-level string manipulation using macros. For example:
string s = "asdf" "lkjh"; // ordinary string literal concatenation
enum E { a, b }; enum E { a, b };
template<int x> template<int x>
@ -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<x>(); string s1 = stringify<a>();
string s2 = stringify<b>();
// ... // ...
} }

Loading…
Cancel
Save