COHERENT manpages

This page displays the COHERENT manpage for trigraph [C Language].

List of available manpages
Index


trigraph -- C Language

A trigraph  is a set of  three characters that represents  one character in
the C character set.  The set of trigraph sequences was defined in the ANSI
Standard to  allow users  to use  the full range  of C characters,  even if
their  keyboards  do not  implement  the full  C  character set.   Trigraph
sequences  are also  useful with  input  devices that  reserve one  or more
members of the C character set for internal use; e.g., the Hazeltine family
of terminals, which reserves the tilde `~' as its escape character.

Each  trigraph sequence  is introduced  by two  question marks.   The third
character in  the sequence indicates which  character is being represented.
The following table gives the set of trigraph sequences:

      Trigraph  Character
      Sequence Represented

         ??=        #
         ??(        [
         ??/        \
         ??)        ]
         ??'        ^
       ??<       {
         ??!        |
       ??>       }
         ??-        ~

The characters represented are the ones used in the C character set but not
included in the ISO 646 character set.  ISO 646 describes an invariant sub-
set of the ASCII character set.

Trigraph  sequences are  interpreted  even if  they occur  within a  string
literal or a character constant.   Thus, strings that uses a literal ``??''
will  not work  the same  as  under a  non-ANSI implementation  of C.   For
example, the function call

    printf("Feel lucky, punk??!\n");

would print:

    Feel lucky, punk|

To print  a pair of  questions marks, use  the escape sequence  `\??'.  For
example:

    printf("Feel lucky, punk\??!\n");

See Also

cc,
C language
ANSI Standard, §5.2.1.1

Notes

By  default,  the COHERENT  C  compiler cc  ignores  trigraphs.  To  invoke
interpretation of trigraphs, use the option -V3GRAPH.