trigraphs in X3J11

Karl Heuer karl at haddock.ISC.COM
Wed Jun 1 10:22:05 AEST 1988


The story so far: X3J11/ISO says that trigraphs have to exist because some
important character sets don't include symbols like "#".

However, some external representation of this character has to exist anyway.
After all, I can do putc('#', outf) to a text stream and read it back in,
whereupon it must compare equal to '#'; hence there is already some mapping,
independent of trigraphs, between the source character set and the external
character set.  Why can't the translator use this mapping instead of
trigraphs?

Example: suppose I don't have '#' but I do have at least one character which
is not part of ISO 646 (say, '$').  When writing to a text stream, in addition
to possibly mucking around with newlines I convert '#' to the digraph '$='.  I
do the opposite conversion on input.  There is no '$' in the source character
set.  My compiler and text editor are both written in portable C, and neither
knows about this translation (only the stdio library does).  There's no need
for '$' to even be printable.

Rebuttal, anyone?

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list