What exactly is the L prefix in C++?

The literal prefixes are a part of the core language, much like the suffixes:

'a'    // type: char
L'a'   // type: wchar_t

"a"    // type: char[2]
L"a"   // type: wchar_t[2]
U"a"   // type: char32_t[2]

1      // type: int
1U     // type: unsigned int

0.5    // type: double
0.5f   // type: float
0.5L   // type: long double

string-literal:
encoding-prefixopts-char-sequenceopt"
encoding-prefixoptraw-string
encoding-prefix:
u8
u
U
L
posted @ 2018-07-02 11:22  樱木小白——夏问  阅读(125)  评论(0)    收藏  举报