Today I found strange syntax like
int _$[:>=<%-!.0,};
in some old code, but in fact the code is not commented. There seems to be no report of compile errors for this line. I tested it separately and it can compile too:
int main(){ int _$[:>=<%-!.0,}; return 0; }
Why can it compile?
With Digraph (see below), the line is converted to:
int _$[]={-!.0,};
On the right hand side, .0
is the double
literal, !
is the logical negation operator, -
is the arithmetic negation operator, and ,
is the trailing comma. Together {-!.0,}
is an array initializer.
The left hand side int _$[]
defines an int
array. However, there's one last problem, _$
is not a valid identifier in standard C. Some compilers (e.g, gcc) supports it as extension.
C11 §6.4.6 Punctuators
In all aspects of the language, the six tokens
<: :> <% %> %: %:%:
behave, respectively, the same as the six tokens
[ ] { } # ##
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With