Handling of trigraphs is done at the preprocessing stage. This means they are replaced everywhere, which can became the cause of subtle bugs.
Trigraph
Replacement
??=
#
??/
\
??'
^
??(
[
??)
]
??!
|
??<
{
??>
}
??-
~
· Within a string literal:
"He said 'Hello???'." becames "He said 'Hello?^.".· Within a line comment:
// Whats wrong with this??/
void i = 0; // This line is also inside the line comment.
Digraphs were supplied as more readable alternatives to six of the trigraphs.
Unlike trigraphs, digraphs are handled during tokenization, so they pose no harm.
Digraph
Replacement
<:
[
:>
]
<%
{
%>
}
%:
#
%:%:
##
No comments:
Post a Comment