malloced structure initilization
Larry Jones
scjones at sdrc.UUCP
Wed Feb 15 09:01:59 AEST 1989
In article <1874 at dataio.Data-IO.COM>, bright at Data-IO.COM (Walter Bright) writes:
> In article <8894 at alice.UUCP< ark at alice.UUCP (Andrew Koenig) writes:
> <init_foo is guaranteed to be initialized because it's static.
>
> Yah, and init_foo is guaranteed to be initialized to a 0 bit pattern,
> just like if you called calloc instead of malloc. So where have you
> gained anything here? I suggest that you declare init_foo something like:
> static struct foo init_foo = { 0,0L,0.0,(char *)0 };
> or whatever is appropriate to the struct members.
dpANS requires statics to be initialized to zeros of the
appropriate type, not just zero bits. I believe this is existing
practice.
----
Larry Jones UUCP: uunet!sdrc!scjones
SDRC scjones at sdrc.UU.NET
2000 Eastman Dr. BIX: ltl
Milford, OH 45150 AT&T: (513) 576-2070
"When all else fails, read the directions."
More information about the Comp.lang.c
mailing list