Re: pointer plus an integer






"James Kuyper Jr." <jameskuyper@xxxxxxxxxxx> wrote in message
news:gNHQi.699$H92.359@xxxxxxxxxxx
Wade Ward wrote:
"James Kuyper Jr." <jameskuyper@xxxxxxxxxxx> wrote in message
news:7z5Qi.793$hI1.195@xxxxxxxxxxx
...
Correct. That's exactly the historical development of the NRC (Numerical
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.
No, incorrect. This pointer-infested slop was never fortran.

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.
That's probably a fair run-down on what happened.
--
wade ward
"Nicht verzagen, Bruder Grinde fragen."


.



Relevant Pages

  • Re: Request for comment: follow-up to Summer of Code
    ... > (FORTRAN (MATMUL X Y IDIM) ... > just prefer Lisp. ... the point of the translation results was to show that there were ... But benchmarks are always transitory and saying one language is better than ...
    (comp.lang.lisp)
  • Re: Help - SYSUAF and $SETUAI on UAI$_USER_DATA field
    ... Certainly in Fortran. ... Logical name resolution is attempted on the devicename ... Logical name resolution is attempted on the name (SYSUAF) ... the translation that may be performed with respect to the default ...
    (comp.os.vms)
  • Re: zwofz.fs
    ... It is a direct translation from Fortran to Forth, ... Another approach for translating from Fortran using a slight variation ... fvalues{DAUX XAUX CC H H2 QLAMBDA RX RY SX SY TX TY W1 C} ... XQUAD RMAXEXP F> OR IF 0e 0e true EXIT THEN ...
    (comp.lang.forth)
  • Re: pointer plus an integer
    ... This pointer-infested slop was never fortran. ... 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". ... 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. ...
    (comp.lang.c)
  • Re: Is there an English translation of these recipes?
    ... Are you saying that it includes the additional recipes which were in the ... Turkish translation of al-Baghdadi being described below? ... > Prospect Books, 2001. ... >> cuisine of Ottoman Turkey escaped the curiosity of scholars. ...
    (rec.org.sca)