Newsgroups: comp.lang.c Path: utzoo!utgpu!jarvis.csri.toronto.edu!dgp.toronto.edu!flaps From: flaps@dgp.toronto.edu (Alan J Rosenthal) Subject: Re: trigraphs in X3J11 Message-ID: <8805261740.AA00659@explorer.dgp.toronto.edu> Organization: University of Toronto References: <5215@ico.ISC.COM> <1490@eneevax.UUCP> <1988May23.000451.751@utzoo.uucp> <5391@ico.ISC.COM> Date: Thu, 26 May 88 12:20:43 EDT In article <5391@ico.ISC.COM> rcd@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.