FREE

Michael Meissner meissner at osf.org
Fri Mar 2 05:58:40 AEST 1990


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:
| >>calloc does what you want and even initialize the space to zeroes for you.
| >
| >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.
--
Michael Meissner	email: meissner at osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA

Catproof is an oxymoron, Childproof is nearly so



More information about the Comp.lang.c mailing list