Xref: utzoo comp.lang.fortran:842 comp.lang.c:11004
Path: utzoo!attcan!uunet!mcvax!philmds!leo
From: leo@philmds.UUCP (Leo de Wit)
Newsgroups: comp.lang.fortran,comp.lang.c
Subject: Re: Variable dimensioning in fortran (now in C)
Keywords: language conversions, FORTRAN, c
Message-ID: <539@philmds.UUCP>
Date: 29 Jun 88 22:35:59 GMT
References: <2742@utastro.UUCP> <20008@beta.UUCP> <224@raunvis.UUCP> <527@philmds.UUCP> <760@naucse.UUCP>
Reply-To: leo@philmds.UUCP (L.J.M. de Wit)
Organization: Philips I&E DTS Eindhoven
Lines: 35

In article <760@naucse.UUCP> rrr@naucse.UUCP (Bob Rose ) writes:
  [calloc stuff deleted]...
|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.

As a matter of fact, the calloc() came from someone else's article.
That person used a calloc for each row of the array and a calloc for
the array of pointers to the rows. I didn't even bother to change them
to malloc's which I use myself normally; perhaps to make the comparing
easier (how's that for an excuse ? ;-).

As for initialization, I think it is better to have that as a separate
function; there may just be cases in which it is inefficient to first
set all values to zero, then fill it with values.

|| |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

Make it a pipe of peace. And now you did it (to) yourself:
you made yourself clear using calloc 8-)
(but that's allowed in this case, you being an integer person, not some
double-crosser %-).

                    !!leo