| Start | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Trigraphs The symbols To solve this problem, the C standard suggested the use of combinations of three characters to produce a single character called a trigraph. A trigraph is a sequence of three characters, the first two of which are question marks. The following is a simple example that uses trigraph sequences instead of This will be changed by the C preprocessor by replacing the trigraphs with their single-character equivalents as if the code had been written:
Note that trigraphs are problematic because, for example, |
||||||||||||||||||||
| Digraphs In 1994 more readable alternatives to five of the trigraphs were supplied. These use only two characters and are known as digraphs. Unlike trigraphs, digraphs are tokens. If a digraph occurs in another token (e.g. string literals or character constants) then it will not be treated as a digraph, but remain as it is. The following shows the difference before and after processing the digraphs sequence. Which will be treated the same as:
RemarksNot all preprocessors support trigraph sequence processing. Some compilers give an extra option or switch for processing them. Others use a separate program to convert trigraphs. The GCC compiler does not recognize them unless you explicitly request it to do so (use As most platforms in use today support the full range of single characters used in C, digraphs are preferred over trigraphs but the use of any multi-character character sequences is generally discouraged. Also, beware of accidental trigraph use ( |
Read Article
https://develop.horje.com/learn/1434/reference