Skip to content

Commit 0466b1d

Browse files
authored
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: isocpp#2136
1 parent 27e662b commit 0466b1d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

CppCoreGuidelines.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -11365,8 +11365,6 @@ Also, `#` and `##` encourages the definition and use of macros:
1136511365

1136611366
There are workarounds for low-level string manipulation using macros. For example:
1136711367

11368-
string s = "asdf" "lkjh"; // ordinary string literal concatenation
11369-
1137011368
enum E { a, b };
1137111369

1137211370
template<int x>
@@ -11378,9 +11376,10 @@ There are workarounds for low-level string manipulation using macros. For exampl
1137811376
}
1137911377
}
1138011378

11381-
void f(int x, int y)
11379+
void f()
1138211380
{
11383-
string sx = stringify<x>();
11381+
string s1 = stringify<1>(); //ok
11382+
string s2 = stringify<2>(); //does not compile
1138411383
// ...
1138511384
}
1138611385

0 commit comments

Comments
 (0)