trigraphs in X3J11
Doug Gwyn
gwyn at brl-smoke.ARPA
Fri May 20 20:16:22 AEST 1988
In article <5215 at ico.ISC.COM> rcd at ico.ISC.COM (Dick Dunn) writes:
>The draft standard seems to be written in such a way that a compiler MUST
>accept these trigraph sequences.
Yes, a standard-conforming implementation MUST understand trigraphs.
>1. Replacement within strings: This is a change to the existing language.
> It breaks existing programs. ...
> Point: The sequence "??" is not at all rare.
Trigraphs ARE relatively rare in existing code. Yours is the first
example I've seen, in fact. Most applications think ? should be used
as a question mark in messages, perhaps ?? at the end of a few message
strings or in a chess program.
> Why was it [??] chosen as the introducer?
Because all single characters in the ISO invariant code set already had
valid C meanings. Many double-character sequences also already have
meanings. ?? seemed to cause the least disruption to existing practice.
> What I don't understand is why it was decided to
> introduce a brand-new (I assume) mechanism which breaks existing code.
Because nobody, including you, has proposed anything that the Committee
agreed was better, and many C users (for example, Europeans) have a
perceived need that the parochial American outlook does not meet.
The point is that existing practice was deemed unsatisfactory, so
SOMEthing had to change. X3J11 tried to minimize the impact of this
"quiet change".
>Has the trigraph mechanism been tried out, in real practice, anywhere
>prior to the introduction in X3J11?
This specific mechanism is an invention of X3J11, so far as I can
determine. However, use of multi-byte sequences to encode things
that cannot be represented by a single byte is extremely common
practice.
Note, by the way, that I oppose trigraphs, but I can provide a definite
explanation of how the European needs can be met without them, just as
I can explain how the Japanese needs can be met without introducing the
wchar_t stuff. My feeling is that people develop mindsets based on
previous non-optimal design that precludes their understanding what an
optimal design would be like. Probably the difficulty of learning how
to deal with a kludge causes a psychological investment that is hard
to give up.
None of the above, of course, should be construed as official X3J11
information.
More information about the Comp.lang.c
mailing list