Variable dimensioning in fortran (now in C)

Bob Rose rrr at naucse.UUCP
Tue Jun 28 04:24:47 AEST 1988


In article <527 at philmds.UUCP>, leo at philmds.UUCP (Leo de Wit) writes:
> I write:
> > Leo de Wit writes:
> > > [my example using calloc() deleted]
> >Close, but ...  I assume you are using calloc to zero the array, but
                                                             ^^^^^
The array was of double!!!!!
> >the whole world is not a VAX. Try:
> >
> > [Bob's example using malloc() deleted]
> 
> What makes you think calloc() is VAX-specific? I checked with K&R:
> [ ... its in all the man pages and dpANS ...  ]

You misunderstood me. (A lot of people have been doing that lately,
maybe I need a vacation :-) Calloc is available every where except on
systems totally brain damaged. The thing is calloc binary zero's the
memory. The array you where zeroing was of type double. Now no where
does it say that the internal representation of a double must be binary
zero (most machines it is, but NOT all.) This turns out to be one of
those hard to find bugs when porting to an odd ball architecture.

> >Just fuel for the fire.
> Thanks! So I can light my cigar now 8-).
> 
>                    Leo++

So did I make myself clear or should I buy you a box of cigars for the
long battle ahead :^)
                     --bob

P.S. I would sure like a chapter and vers if calloc can be used to
create an array of zeroed doubles.



More information about the Comp.lang.c mailing list