End user implications of trigraphs (SUMMARY)

Matt S Wartell msw at cisunx.UUCP
Wed May 3 23:30:49 AEST 1989


Thanks to all who responded to my somewhat naive question about trigraphs.
As was pointed out by all of the respondants, my question was ill-formed.
I had asked if
	puts("trigraph??");
would break under the pANS.  Since ??" is not a ISO-646 trigraph, my example
would work fine.  If the question were:
	puts("trigraph??!");
the answer would be: yes, this will generate "trigraph|" instead of 
"trigraph??!".

It was also pointed out that ISO-646 trigraphs _have_ been incorporated
into the proposed standard.  For what it's worth, trigraphs are here.

However, a few people noted that self-respecting ANSI compilers would
probably have a "disable-trigraphs" or "enable-trigraphs" option.

A helpful solution came from Karl Heuer via Mark Brader's .signature:
	sed -e "s;??\\([-=(/)'<!>]\\);?\\\\?\\1;g"
will protect trigraphs-that-weren't-meant-to-be-trigraphs in existing
code.  Thus, the ??! from my example would become ?\?! when transformed
by sed.  One caveat: the ?\? construction may fail on pre-ANSI compilers.

Thanks again to Karl Heuer, Marv Rubinstein, Gordon L. Burditt, 
Stephen J. Friedl, Mark Brader and David H. Wolfskill for their kind
responses. 
-- 
matt wartell, university of pittsburgh             msw at unix.cis.pittsburgh.edu



More information about the Comp.std.c mailing list