Sun Studio 12 Update 1: C++ User's Guide

A.2.184 -xtrigraphs[={yes|no}]

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.

A.2.184.1 Values

You can specify one of the following two values for -xtrigraphs:

Table A–51 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 

Defaults

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.

Examples

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 (??)

See also

For information on trigraphs, see the C User’s Guide chapter about transitioning to ANSI/ISO C.