mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 12:44:42 +03:00
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.
This commit is contained in:
@@ -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<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>();
|
||||
// ...
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user