Trigraphs and Pragmas

Karl Heuer karl at haddock.ISC.COM
Wed Jun 1 10:17:10 AEST 1988


In article <6757 at cit-vax.Caltech.Edu> beckenba at cit-vax.UUCP (Joe Beckenbach) writes:
>To add to trigraph sequences, perhaps something like:
>	#pragma trigraph LBRACE &<
>to allow &< to map to {		[notice &< is never legal C!]

Allowing the character set to change mid-stream would create a whole new mess
of problems.  (Even the simple "#pragma trigraphs off" is troublesome, since
trigraphing precedes comment removal which precedes preprocessor action.)

Given the constraint that trigraphs are staying in the language, I think that
the best solution is: (users:) make sure your code doesn't contain "accidental
trigraphs" (sed -e "s;??\\([-=(/)'<!>]\\);?\\\\?\\1;g"   will fix them), and
(implementors:) issue a warning if a file contains both trigraphs and
trigraphable characters.

Ignoring that constraint, I think that the best solution is to remove them.
I'll discuss this in a separate posting.

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list