Curious trigraph sequence thing about ansi C
What was is it the original reason to use trigraph sequence of some chars to become other chars in ansi C like:
??=define arraycheck(a, b) a??(b?开发者_如何学JAVA?) ??!??! b??(a??)
becomes
#define arraycheck(a, b) a[b] || b[a]
Short answer: keyboards/character encodings that didn't include such graphs.
From wikipedia:
The basic character set of the C programming language is a superset of the ASCII character set that includes nine characters which lie outside the ISO 646 invariant character set. This can pose a problem for writing source code when the keyboard being used does not support any of these nine characters. The ANSI C committee invented trigraphs as a way of entering source code using keyboards that support any version of the ISO 646 character set.
http://en.wikipedia.org/wiki/Digraphs_and_trigraphs
Some old keyboards didn't have specific characters on them, so the language worked around it by letting you use trigraphs instead.
精彩评论