Matthew Saltzman wrote:
On Thu, 31 May 2007, Mike McCarty wrote:
[in regards to initializing statically allocated variables]
IIRC, it was mentioned in K&R v1.
My K&R1 is lost to history 8^(, but my H&S 3rd edition spent a lot of
So is mine :-(
space on the difference between "traditional" or "K&R" and ANSI
compilers. In the section on default initialization the only static vars
that were *not* required to be initialized in traditional compilers were
unions. The note says that some traditional compilers would not permit
such initializations. The ANSI requirement is that the union be
initialized to the default for the first element.
The other note was that some traditional compilers would initialize a
static float/double to all-bits-zero, even if that was not the
representation of 0.0. That's not permitted in ANSI C.
Thank you for the clarification. Also not permitted in ANSI C
is the initialization of pointers to all-bits-zero if that
is not (one of the permitted) values of NULL.
Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
Oppose globalization and One World Governments like the UN.
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!