Is malloc() or calloc() "better"?
Jim Patterson
jimp at cognos.uucp
Wed Jan 11 00:35:58 AEST 1989
In article <17067 at onfcanim.UUCP> dave at onfcanim.UUCP (Dave Martindale) writes:
> I've seen people who use
>calloc to zero their allocated arrays or structures assume that
>"all bits zero" is the proper value for floating-point zero -
>definitely not true on all machines.
I'm compiling a list of such machines, but it's still empty. Can you
enlighten us as to what some of these machines are? Do they have C
compilers? Is all-bits-zero actually invalid (i.e. will cause a trap
of some sort), or is it just not the "preferred" representation of
zero? (I suspect that many BCD floating-point implementations won't
even bother to check in the interests of efficiency, and so will end
up getting it right anyways).
I also agree that zero-filled memory isn't (maximally) portable, but I
still don't know what machines it's not portable to.
--
Jim Patterson Cognos Incorporated
UUCP:decvax!utzoo!dciem!nrcaer!cognos!jimp P.O. BOX 9707
PHONE:(613)738-1440 3755 Riverside Drive
Ottawa, Ont K1G 3Z4
More information about the Comp.lang.c
mailing list