Sun Studio 12 Update 1:C++ 用户指南

示例

以下示例显示了前面带有 U 的带引号文本字符串。另外,还显示了指定 -xustr 的命令行。


example% cat file.cc
const unsigned short *foo = U"foo";
const unsigned short bar[] = U"bar";
const unsigned short *fun() {return foo;}
example% CC -xustr=ascii_utf16_ushort file.cc -c

8 位字符文字前面可以带有 U,以形成类型为 unsigned short 的 16 位 UTF-16 字符。示例:


const unsigned short x = U'x';    
const unsigned short y = U'\x79';