启用或禁用对 ISO/ANSI C 标准定义的三字母序列的识别。
如果源代码具有包含问号 ( ?) 的文字串(编译器将其解释为三字符序列),那么您可以使用 -xtrigraph=no 子选项禁用对三字符序列的识别。
-xtrigraphs 可以是下列值之一:
表 A–52 -xtrigraphs 值
值 |
含义 |
---|---|
yes |
启用整个编译单元三字母序列的识别 |
no |
禁用整个编译单元三字母序列的识别 |
如果没有在命令行上指定 -xtrigraphs 选项,则编译器假定 -xtrigraphs=yes。
如果仅指定了 -xtrigraphs,则编译器假定 -xtrigraphs=yes。
请考虑以下名为 trigraphs_demo.cc 的示例源文件。
#include <stdio.h> int main () { (void) printf("(\?\?) in a string appears as (??)\n"); return 0; } |
下面是使用 -xtrigraphs=yes 编译该代码后的输出。
example% CC -xtrigraphs=yes trigraphs_demo.cc example% a.out (??) in a string appears as (] |
下面是使用 -xtrigraphs=no 编译该代码后的输出。
example% CC -xtrigraphs=no trigraphs_demo.cc example% a.out (??) in a string appears as (??) |
有关三字母的信息,请参见《C 用户指南 》中关于转换到 ANSI/ISO C 的章节。