trigraphs in X3J11

Robert Lenoil lenoil at Apple.COM
Tue May 24 10:47:27 AEST 1988


In article <5215 at ico.ISC.COM> rcd at ico.ISC.COM (Dick Dunn) writes:
>    Note also that it is common practice to use "?" in initializing strings
>    where the "?" positions will be replaced at execution time.

Dick is dead right here.  What is the justification for breaking existing
programs when the ability to include untypeable characters into strings already
exists via the \xxx mechanism?  Instead of introducing a totally new notion
(to C, anyway) of trigraphs, why not simply extend the backslash escape
mechanism to be valid outside of strings?  This would allow the use of #defines
to perform the same function as trigraphs:

#define ??< \173	/* open brace */
#define ??> \175	/* close brace */

By using the backslash escapes in strings and your favorite synonym outside of
strings, the same effect is reached without breaking any existing code.  If
people don't want to use the backslash escapes in strings, they can make use of
the new stringizing operators to get the #define'd constants into their
strings.

Robert Lenoil
Apple Computer, Inc.



More information about the Comp.lang.c mailing list