trigraphs in X3J11

Alan J Rosenthal flaps at dgp.toronto.edu
Fri May 27 02:20:43 AEST 1988


In article <5391 at ico.ISC.COM> rcd at ico.ISC.COM (Dick Dunn) writes:
[ re a compiler switch for trigraphs ]
>If the programmer writes:
>	printf("What on earth??!\n");
>a standard-conforming compiler should produce code which will cause the
>program to print:
>	What on earth|
>If instead it produces code which causes the program to print:
>	What on earth??!
>it's violating the standard.

Just goes to show you that conforming compilers are not likely to be
the most useful compilers.  However, the ansi standard doesn't say that
the conforming compiler must be called `cc'.  Most implementors will
probably say that it's called `cc -trigraph' (with probably other
switches as well).  Or, to put it another way, I fully expect all
ansi-conforming compilers to come in two flavours:  a strictly
conforming one and a useful one.

>If you're compiling your own code, you know when to turn on the trigraph
>switch on the compiler...but if you're compiling jrandom.c that you got on
>a tape from somebody, what do you do?  Is it a standard program?  Was it
>written before the standard came out?  (There are a couple of files in the
>netnews source which fall into just this hole.)

Ahem, all C programs were written before the standard comes out.  The
standard has not yet come out.

Anyway, to answer your question, you simply compile it without the
-trigraph switch and also without the -nocomplaintrigraph switch.  In
other words, a useful compiler will not implement trigraphs but will
give a warning message when it encounters them.

One might still argue that you then have to decide whether to recompile
with the -trigraph switch or not.  However I maintain that this problem
exists whether or not there is a compiler switch to solve it.

ajr

--
- Any questions?
- Well, I thought I had some questions, but they turned out to be a trigraph.




More information about the Comp.lang.c mailing list