Use this option if your code contains string literals that you want the compiler to convert to UTF-16 strings in the object file. Without this option, the compiler neither produces nor recognizes sixteen-bit character string literals. This option enables recognition of the U"ASCII_string" string literals as an array of unsigned short int. Since such strings are not yet part of any standard, this option enables recognition of non-standard C++.
Not all files have to be compiled with this option.
Specify -xustr=ascii_utf16_ushort if you need to support an internationalized application that uses ISO10646 UTF-16 string literals. You can turn off compiler recognition of U"ASCII_string" string literals by specifying -xustr=no. The right-most instance of this option on the command line overrides all previous instances.
You can specify -xustr=ascii_ustf16_ushort without also specifying a U"ASCII_string" string literal. It is not an error to do so.
The default is -xustr=no. If you specify -xustr without an argument, the compiler won’t accept it and instead issues a warning. The default can change if the C or C++ standards define a meaning for the syntax.
The following example shows a string literal in quotes that is prepended by U. It also shows a command line that specifies -xustr
example% cat file.cc const unsigned short *foo = U"foo"; const unsigned short bar[] = U"bar"; const unsigned short *fun() {return U"fun"}; example% CC -xustr=ascii_utf16_ushort file.cc -c |
Sixteen-bit character-literals are not supported.