Trigraphs -- some numbers

D. Hugh Redelmeier hugh at dgp.toronto.edu
Fri May 27 23:28:42 AEST 1988


In article <847 at fig.bbn.com> rsalz at bbn.com (Rich Salz) writes:
>I logged on to the machine that has our Sun3.2 sources and did
>	find . -type f -print | xargs fgrep '??' >/tmp/tri
>	vi /tmp/tri	# to remove comments, etc.

Ah, but trigraphs are converted in comments too!  Consider the following:

/* This comment ends only if trigraphs are handled correctly *??/
/

>Most uses fall into these two types:
>	printf("%s", ptr ? ptr->field : "???");
>	static char tty[] = "/dev/tty??";

Notice that ??" is not a trigraph, so these examples are no problem.
I recently checked about 15000 lines of my own code, and found only
one (accidental) trigraph.  It was in a comment, and treating it as a
trigraph had no effect:

	/* no value will be greater than 10 (really???) */

Hugh Redelmeier
{utcsri, utzoo, yunexus, hcr}!redvax!hugh
In desperation: hugh at csri.toronto.edu
+1 416 482 8253




More information about the Comp.lang.c mailing list