translation phases

Daniel Edelson daniel at terra.ucsc.edu
Sat Feb 23 05:24:41 AEST 1991


Can someone please tell me if this is a correct interpretation
of section 2.1.1.2 of the standard. (I apologize if this is something
that has been thrashed to death already in this newsgroup.)

According to the translation phases, line splicing occurs before
escape sequence replacement. Therefore, a '\\newline' sequence
in a character or string constant should translate to a single
backslash. This will be a syntax error unless it is part of
a valid escape sequence.

In particular:

char msg[] = "\\
t";

This should translate to:

msg[0] = '9';   /* tab */
msg[1] = '0';   /* null sentinel */

rather than

msg[0] = '92';  /* backslash */
msg[1] = '10';  /* newline */
msg[2] = '116'; /* `t' */
msg[3] = '0';   /* null sentinel */


Thanks,

Daniel Edelson
uunet!peren!daniel
 or
daniel at cis.ucsc.edu



More information about the Comp.std.c mailing list