trigraphs in X3J11

Karl Heuer karl at haddock.ISC.COM
Fri Jun 3 15:59:44 AEST 1988


In article <8806021259.AA21135 at decwrl.dec.com> minow at thundr.dec.com (Martin Minow THUNDR::MINOW ML3-5/U26 223-9922) writes:
>[A Swedish user] writes his first program as:
>	??= include <stdio.h>
>	main() ??< printf("H{lsningar fr}n Visby p} \land!??/n"); ??>
>When he runs my compiler, How does it know that the charcter whose value
>is decimal 92 is a national letter, and not a backslash that crept in?
>Do I need command line arguments or a ??=pragma?  Are they permitted by
>the standard?

It's up to the implementation to specify the character set.  You could have
one translator which believes `\' is a backslash, and a different one which
believes it's a national letter.  You can select which of these two
implementations is to compile the program by using a command-line argument.

>Will all ??=include files be required to be distributed in their
>trigraphed format?

It isn't necessary; you could supply a different set of include files with the
two implementations.  (E.g. `cc -{' could mean `interpret {|}[\] as national
characters and use /usr/include/swedish/*.h, while `cc +{' means `interpret
them as punctuation and use /usr/include/ascii/*.h'.)

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