- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
标准似乎对 char16_t
字面值有两种不同的响应,其中包含一个不能用 char16_t
表示的字符。首先,如果代码点值不能用 16 位表示(即它不在基本多语言平面 (BMP) 中),则程序格式错误 (§2.14.3/2):
The value of a
char16_t
literal containing a single c-char is equal to its ISO 10646 code point value, provided that the code point is representable with a single 16-bit code unit. (That is, provided it is a basic multi-lingual plane code point.) If the value is not representable within 16 bits, the program is ill-formed.
由于 \U0001ABCD
是单个 c-char1 但不在 BMP 中,因此包含它的程序格式错误。
好的,但稍后在同一章中,它说如果该值超出 char16_t
的实现定义范围,则文字具有实现定义的值(§2.14.3/4):
The value of a character literal is implementation-defined if it falls outside of the implementation-defined range defined for [...]
char16_t
(for literals prefixed by ’u
’) [...]
由于 char16_t
的实现定义范围必须至少为 16 位(以便能够存储整个 BMP),我们已经知道该程序对于落在在那个范围之外。为什么该标准费心给它一个实现定义的值?
1 产生式规则是c-char -> universal-character-name -> \U
六边形 六边形
最佳答案
根据 2.14.3/2,程序格式错误,这意味着必须诊断错误。不需要进一步分析,因为不需要实现来完成编译或生成可执行文件。文字可能被认为仍然具有值(value),但这并不重要。
(虽然实现允许编译和执行格式错误的程序。所以我想在那种情况下,字 rune 字仍然被指定为具有值这一事实很重要。)
关于c++ - u'\U0001ABCD' 是否具有实现定义的值或格式错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13554914/
我想写我自己的 compareTo 方法,所以我写了这段简单的代码: public int myCompare(String a, String b) { int min = Math.min
这个问题在这里已经有了答案: Why use parentheses when returning in JavaScript? (9 个回答) 关闭 6 年前。 我正在努力处理一些 JavaScr
void main() { printf("ABCD"); printf("\n"); printf("ABCD" +1); printf("\n"); printf("ABC
为什么在字符串 abcd 1234 abcd 上使用正则表达式 .* 时会得到两个匹配项?请参阅https://regex101.com/r/rV8jfz/1 . 从regex101给出的解释中,我可
为什么在字符串 abcd 1234 abcd 上使用正则表达式 .* 时会得到两个匹配项?请参阅https://regex101.com/r/rV8jfz/1 . 从regex101给出的解释中,我可
def censor2(filename): infile = open(filename,'r') contents = infile.read() contentlist
经过大量的反复试验,我是这样做的: #include #include #include /*Prototype of a hashtag function*/ void hashtag(cha
首先让我承认,通过以不重叠的方式命名类型和变量来避免这种情况很容易。 尽管如此,我很好奇在以下情况下会发生什么: typedef char jimmypage; jimmypage *jimmypag
我正在研究“c 编程语言”练习 2.4,它删除 s1 中与字符串 s2 中的任何字符匹配的每个字符。下面是我的代码,它有效。但是,如果我将 Main 函数中的定义从 char c1[ ]="abcde
所以我们创建了一个 map 。我们想要获取 some_type blah = map_variable[some_not_inserted_yet_value] 如果之前没有创建,这将调用向 map
Directory.GetFiles(LocalFilePath, searchPattern); MSDN 注释: When using the asterisk wildcard characte
到目前为止,当你输入 f 时没有任何反应,它只在输入 0 时有效,但我想要它,所以当你按 f 时,你会得到这个 a ab abc abcd abcde abcdef #include using n
每当我使用 vim 时,按上、下、左、右,它分别映射到 A、B、C、D,但仅限于插入模式。在插入模式之外,这些键可以正常工作。我检查了 .vimrc 文件,没有发现任何可能导致此问题的可疑内容。 我使
给定与属性 ABCD 的关系,知道没有记录具有 NULL 值,如何编写证明函数依赖关系 A → B 的 SQL 语句? 最佳答案 SELECT * from R r1, R r2 where r1.A
我正在使用一些不是我编写的旧代码,并且需要一些帮助来理解它。 (function() { var abc = "SORocks"; $.fn[abc] = function (x) {
昨天我正在解决 Spoj 问题 ABCD:http://www.spoj.com/problems/ABCD/ 我得到了错误的答案,但我真的不明白为什么。我已经尝试了论坛和评论中的所有测试用例。是否接
我有一个像 'g fmnc wms bgblr rpylqjyrc gr zw fylb' 这样的字符串。我在 python 中使用 .split() 函数并获取 ['g', 'fmnc', 'wms
如何编写 Javascript 正则表达式来匹配除给定字符串(“ABCD”)以外的所有内容? 类似于 /[^ABCD]/ 除了我不想匹配所有不是字母 A、B、C 或 D 的东西。我想匹配所有不是的东西
这个问题在这里已经有了答案: How do I compare strings in Java? (23 个回答) 关闭 8 年前。 String s1 = new String("anil
我知道还有其他关于语法 class #> #What does this outputs mean??????? def onSelf.SelfMet puts 'This is a met
我是一名优秀的程序员,十分优秀!