FREE

Shiping Zhang ping at cubmol.bio.columbia.edu
Sat Mar 3 02:26:01 AEST 1990


In article <MEISSNER.90Mar1135840 at curley.osf.org> meissner at osf.org (Michael Meissner) writes:
[In article <1990Mar1.140829.17199 at druid.uucp> darcy at druid.uucp (D'Arcy
[J.M. Cain) writes:
[
[| In article <16055 at haddock.ima.isc.com> karl at haddock.ima.isc.com (Karl Heuer) writes:
[| >In article <1990Feb27.155133.20341 at druid.uucp> darcy at druid.UUCP (D'Arcy J.M. Cain) writes:
[| >
[| >The calloc() function is disrecommended.  Generally speaking, you should use
[| >malloc() and initialize the contents yourself.
[| >
[| I've heard that before but not the reason.  So why is it disrecommended?
[
[Because there exist machines whose floating point 0.0 does not have
[all bits zeroed.  There are also machines where a NULL pointer does
[not have all bits zeroed.  Using calloc will probably work 99.99%, but
[do you want to have to be the 'lucky' person who has to track down why
[such a machine gives funny answers.

My question is
    Why is NOT calloc() made machine independent.
I also often asked (to myself)
    Why is NOT malloc() made to initialize the contents automatically?
I simply can not think of any case where the initial contents would
be useful for some purpose and should be preserved. Is the efficiency
a matter here?


-ping



More information about the Comp.lang.c mailing list