Possible Duplicate:
Why are there digraphs in C and C++?
What does the C ??!??! operator do?!
In C++ there are alternative tokens for [] and {}, among others.
E.g. the following code compiles:
%:include <stdio.h>
int main() <%
printf("Hello World!");
}
I thought about it for a while but couldn't figure any applicability, is there any logical reason for this?
They're a hangover from C, really. There were implementations of C in which not all characters were available (such as some variants of EBCDIC that have no square brackets).
The C99 rationale document, section 5.2.1.1 Trigraph sequences
has this to say:
Trigraph sequences were introduced in C89 as alternate spellings of some characters to allow the implementation of C in character sets which do not provide a sufficient number of non-alphabetic graphics.
The characters in the ASCII repertoire used by C and absent from the ISO/IEC 646 invariant repertoire are
#
,[
,]
,{
,}
,\
,|
,~
, and^