trigraphs in X3J11

Dick Dunn rcd at ico.ISC.COM
Wed May 25 10:16:53 AEST 1988


> > Our particular implimentation was controlled by an option flag, so it didn't
> > harm native mode APL work.  A clear deficiency in the ANSI proposal.
> I would expect that this is the way many C compilers will implement trigraphs;
> I know of some that already take that approach.  Lots of people share your
> view that trigraphs are ugly.

Adding a compiler switch may be the "least bad" solution that a rational
compiler writer can find...but it gives programmers an ugly choice:  The
compiler either transmogrifies trigraphs or it compiles programs in a
nonstandard way.

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.

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.)
-- 
Dick Dunn      UUCP: {ncar,cbosgd,nbires}!ico!rcd       (303)449-2870
   ...If you get confused just listen to the music play...



More information about the Comp.lang.c mailing list