宽字符字面量前缀 L 是什么意思?

yisikaipu yisikaipu 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
咬文嚼字

1,C/C++标准里没有任何解释
2,Rationale 里只解释了为什么用前缀而不是后缀

那么,L 难道就是 Literal 的首字母?或是 Large,或是 Long ?

何不用 Wide ?据说是重用已有的 long 字面量后缀字母?

有没有确切的说法

大家认为是什么

下面是引文

C99
$6.4.5 String literals
$6.4.5/2
A character string literal is a sequence of zero or more multibyte characters enclosed in double-quotes, as in "xyz".A wide string literal is the same, except prefixed by the letter L.

C++2003
$2.13.2 Character literals
$2.13.2/1
A character literal is one or more characters enclosed in single quotes, as in ’x’, optionally preceded by the letter L, as in L’x’.

$2.13.2/2
A character literal that begins with the letter L, such as L’x’, is a wide-character literal. A wide-character literal has type wchar_t.

Rationale for International Standard Programming Languages C
$6.4.5 String literals
An L prefix distinguishes wide string literals. A prefix rather than a suffix notation was adopted so that a translator can know at the start of the processing of a string literal whether it is dealing with ordinary or wide characters.
...全文

相关推荐

评论 37
收藏 已收藏
分享
返回顶部
yisikaipu
C++ 语言 65,214 成员 250,514 内容