Posts tagged EBCDIC
Trigraph char sequences in C & C++
6![]()
There are some triplet character sequences present in C & C++ to represent some special punctuation characters. The trigraph sequences are used for compatibility of source code written in ISO 646 or EBCDIC charset.
![]()
// Is this a valid statement? I can’t believe. But for compiler is valid.
??=define arraycheck(a,b) a??(b??) ??!??! b??(a??)
But when we apply trigraph sequence, the above code block became as follows.
// Wow!!! It’s a valid one…
#define arraycheck(a,b) a[b] || b[a]
Please see list of trigraph sequences below.
Trigraph Punctuation Character
??= #
??( [
??/ \
??) ]
??’ ^
??< {
??! |
??> }
??- ~
And one trigraph pitfall.
// Whether the following line compiles ???????/
cout << “Whether you can see this message?”;
Find your answer and take care trigraphs next time…
Thanks to Wiki for examples and the list.