translation phases
Doug Gwyn
gwyn at smoke.brl.mil
Sun Feb 24 07:33:34 AEST 1991
In article <12696 at darkstar.ucsc.edu> daniel at terra.ucsc.edu (Daniel Edelson) writes:
>According to the translation phases, line splicing occurs before
>escape sequence replacement.
But after trigraph replacement.
>Therefore, a '\\newline' sequence
>in a character or string constant should translate to a single
>backslash.
Correct.
>This will be a syntax error unless it is part of
>a valid escape sequence.
Or comment, header name, etc.
>char msg[] = "\\
>t";
>This should translate to:
>msg[0] = '9'; /* tab */
>msg[1] = '0'; /* null sentinel */
Assuming the ASCII code set, the effect of the initializer is:
msg[0] = 9;
msg[1] = 0;
(Not quite what you said.)
I suspect there are so-called "ANSI C" compilers in existence that
get this wrong.
More information about the Comp.std.c
mailing list