Enables or disables recognition of trigraph sequences as defined by the ISO/ANSI C standard.
If your source code has a literal string containing question marks (?) that the compiler is interpreting as a trigraph sequence, you can use the -xtrigraph=no suboption to turn off the recognition of trigraph sequences.
You can specify one of the following two values for -xtrigraphs:
Table A–52 The -xtrigraphs Values
Value |
Meaning |
---|---|
yes |
Enables recognition of trigraph sequences throughout the compilation unit |
no |
Disables recognition of trigraph sequences throughout the compilation unit |
When you do not include the -xtrigraphs option on the command line, the compiler assumes -xtrigraphs=yes.
If only -xtrigraphs is specified, the compiler assumes -xtrigraphs=yes.
Consider the following example source file named trigraphs_demo.cc.
#include <stdio.h> int main () { (void) printf("(\?\?) in a string appears as (??)\n"); return 0; } |
Here is the output if you compile this code with -xtrigraphs=yes.
example% CC -xtrigraphs=yes trigraphs_demo.cc example% a.out (??) in a string appears as (] |
Here is the output if you compile this code with -xtrigraphs=no.
example% CC -xtrigraphs=no trigraphs_demo.cc example% a.out (??) in a string appears as (??) |
For information on trigraphs, see the C User’s Guide chapter about transitioning to ANSI/ISO C.