Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!ames!necntc!ima!haddock!karl
From: karl@haddock.ISC.COM (Karl Heuer)
Newsgroups: comp.lang.c
Subject: Re: trigraphs in X3J11
Summary: A better mousetrap
Message-ID: <4314@haddock.ISC.COM>
Date: 1 Jun 88 00:22:05 GMT
Reply-To: karl@haddock.ima.isc.com (Karl Heuer)
Organization: Interactive Systems, Boston
Lines: 21

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@haddock.isc.com), The Walking Lint