Re: pointer plus an integer
- From: "Wade Ward" <zaxfuuq@xxxxxxxxxxx>
- Date: Mon, 15 Oct 2007 14:30:11 -0700
"James Kuyper Jr." <jameskuyper@xxxxxxxxxxx> wrote in message
news:gNHQi.699$H92.359@xxxxxxxxxxx
Wade Ward wrote:That's probably a fair run-down on what happened.
"James Kuyper Jr." <jameskuyper@xxxxxxxxxxx> wrote in message...
news:7z5Qi.793$hI1.195@xxxxxxxxxxx
Correct. That's exactly the historical development of the NRC (NumericalNo, incorrect. This pointer-infested slop was never fortran.
Recipes in C) library. I've translated a fair number of their
"Fortran-inspired C" routines into "native C" style; the effort was
significant; avoiding off-by-one errors in loops required constant
vigilance - I can understand why someone not very familiar with C might
have chosen this awful work-around to avoid having to do that same work.
I didn't say that it was. That pointer-infested slop was created during
the translation process from Fortran to C, apparently by someone far more
familiar with Fortran than with C. It's a clever, but fundamentally
misguided, attempt to create something in C that can be used in a manner
similar to Fortran arrays, thereby simplifying the translation of Fortran
code which indexed those "arrays".
The cost of this design decision was that it made the code hard to
understand for more experienced C programmers, and added in unnecessary
complexity related to allocation and deallocation of those arrays.
The fortran would look more like:
real, allocatable :: A(:,:)
I have a fair amount of experience with Fortran, but it ended a long time
ago, before I ever used a compiler supporting the features you're using in
that statement. I strongly suspect that the original Fortran version of
the Numerical Recipes library also pre-dates those features; or at least,
was written to be backwardly compatible with compilers that did not yet
support them.
--
wade ward
"Nicht verzagen, Bruder Grinde fragen."
.
- References:
- pointer plus an integer
- From: Ivan K.
- Re: pointer plus an integer
- From: Jack Klein
- Re: pointer plus an integer
- From: James Kuyper Jr.
- Re: pointer plus an integer
- From: Wade Ward
- Re: pointer plus an integer
- From: James Kuyper Jr.
- pointer plus an integer
- Prev by Date: Re: About the typecasting to the LHS
- Next by Date: Re: pointer plus an integer
- Previous by thread: Re: pointer plus an integer
- Next by thread: pointer offsetting
- Index(es):
Relevant Pages
|