stringizing
Norman Diamond
diamond at jit345.swstokyo.dec.com
Tue Apr 23 17:55:27 AEST 1991
In article <14888 at darkstar.ucsc.edu> daniel at terra.ucsc.edu (Daniel Edelson) writes:
> #define str(x) #x
> printf("%s\n", str( hello\t\n\vworld\n\n));
>Is the output from this program supposed to be:
> hello world
Section 2.1.1.2, page 6 lines 35-36 in the Dec. 1988 draft:
Whether each nonempty sequence of white-space characters other than newline
is retained or replaced by one space character is implementation-defined.
[This is before preprocessing.]
Therefore, the output can be either (with two leading spaces):
hello\t\n\vworld\n\n\n
or (with one leading space and two imbedded spaces):
hello \n world\n\n\n
(including, in each case, the last \n from the printf format string).
However, it cannot be (regardless of the number of leading spaces) just:
hello world\n
--
Norman Diamond diamond at tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
More information about the Comp.std.c
mailing list