转义字符( \\’ \\” \\? \\\\ )的ascii码值是否与不转义之前相同

标准中定义的只有:\\a \\b \\f \ \\r \\t \\v \\\\ \\\u0026#39; \\" \\? \nn \\xhh这些转义字符对应的ASCII码可以参考这里:Escape sequences in C其余的都是未定义的行为。\\?确实是0x3F,等同于“?”,但不是说所有以"\\"开头的转义字符的ASCII码值都等于后面的那个字符的ASCII码值。甚至,在不同的编译器上,未定义的行为获得的结果都是不一样的。比如\u0026#39;\\e\u0026#39;在VS2008里是101,在GCC里是27.规范里的说法:Each of these escape sequences shall produce a unique implementation-defined value which can be stored in a single char object. The external representations in a text file need not be identical to the internal representations, and are outside the scope of this International Standard.不要去追究规范没有定义的内容。
■网友
刚才用c做了个实验,代码如下:char a = \u0026#39;?\u0026#39;;char b = \u0026#39;\\?\u0026#39;;printf("a is %d, b is %d\", a, b);打出来的结果:a is 63, b is 63这说明转义之后和转义之前本质是一样的。


    推荐阅读