Can we put it in C++ source code?
No, it would be a syntax error.
If not, what’s the usage of ”?
There is no usage, unless your purpose is to cause a compilation error (for which there are probably better alternatives such as static_assert
).
Can it be understood that empty character constant ” is just a pure grammar error just like a variable being named as 2018ch ?
Yes. The grammar says:
character-literal: encoding-prefix opt ' c-char-sequence '
Notice that unlike the encoding-prefix
, c-char-sequence
is not optional.
Side note: Yes, it is a character sequence – multi character literals exist. But you don’t need to learn about them yet other than knowing that you probably won’t need them. Just don’t assume that they’re strings.