Variable dimensioning in fortran (now in C)

Doug Gwyn gwyn at brl-smoke.ARPA
Mon Jun 27 13:24:24 AEST 1988


In article <527 at philmds.UUCP> leo at philmds.UUCP (L.J.M. de Wit) writes:
>In article <749 at naucse.UUCP> rrr at naucse.UUCP (Bob Rose ) writes:
>>In article <517 at philmds.UUCP>, leo at philmds.UUCP (Leo de Wit) writes:
>>> [my example using calloc() deleted]
>>Close, but ...  I assume you are using calloc to zero the array, but
>>the whole world is not a VAX. Try:
>What makes you think calloc() is VAX-specific?

It's true that calloc() exists universally, but its function is to allocate
memory and initialize it with 0 BYTE data.  That does not in general
properly initialize all data types (particularly floating-point and
pointer types), thus the necessity of malloc() followed by an explicit
initialization loop.  On a VAX this use of calloc() typically happens to
work, by accident.



More information about the Comp.lang.c mailing list