[comp.lang.c] Trigraphs -- some numbers

rsalz@bbn.com (Rich Salz) (05/26/88)

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

The numbers?
	120 occurrences
	 79 files
Highest use was usr.bin/at/atq.c, with six.
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.

hugh@dgp.toronto.edu ("D. Hugh Redelmeier") (05/27/88)

In article <847@fig.bbn.com> rsalz@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@csri.toronto.edu
+1 416 482 8253

gwyn@brl-smoke.ARPA (Doug Gwyn ) (05/28/88)

In article <847@fig.bbn.com> rsalz@bbn.com (Rich Salz) writes:
>Most uses fall into these two types:
>	printf("%s", ptr ? ptr->field : "???");
>	static char tty[] = "/dev/tty??";

Neither is affected by trigraph mapping.