Should I convert FORTRAN code to C?
J. Eaton
chpf127 at ut-emx.UUCP
Fri Jun 17 21:46:02 AEST 1988
In article <224 at raunvis.UUCP>, kjartan at raunvis.UUCP (Kjartan Pierre Emilsson Jardedlisfraedi) writes:
>
> [stuff deleted about dynamic memory allocation]
>
> For this particuliar
> data structure, the subroutine is basically a one-liner:
>
> double **Create2DArray(w,h)
> int w,h;{ double **r;
> for(r=(double**)calloc(h,sizeof(*r));h-->0;r[h]=(double*)calloc(w,sizeof(**r)));
> return(r);}
>
> This may look very cryptic but then you only write it once anyway!
Yes, perhaps, but you (and, most likely, someone else) will have
to read it more than once. Will that future reader be able to
quickly grasp what is being done (especially if that future
person is a scientific "programmer")?
> Say it in any language you like, but say it clearly!
I agree.
> Kjartan Pierre Emilsson, Iceland.
J. Eaton
UT Dept of Chemical Engineering
Practice what you preach.
More information about the Comp.lang.c
mailing list