Re: double precision g77



In article <1156434189.889041.35780@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"kilter" <richard.pitman3@xxxxxxxxxxxxxxx> wrote:

By the way, the use of a lower bound when dimensioning the limit vector
is to allow the routine to be called by a C program, which as I am sure
you know defaults to a lower bound of 0.

It is not that C "defaults" to a lower bound of 0, that is the only
way that arrays are referenced in C. In fortran, by contrast, the
lower bound can be specified to fit the problem. The "Numerical
Recipes in C" book attempted to overcome this fault in the C
language by doing tricks with pointer offsets, but this results in
illegal C code (which happens to work on most machines anyway, but
that is a separate issue).

Also, the lower bound in a subprogram has nothing to do with the
lower bound in the calling program, whether that calling program is
written in fortran or C. The same idea holds for row-major or
column-major indexing of multidimensional arrays. As long as the
array in both languages maps to the same physical memory layout, you
can call fortran subprograms from C without needing to shift the
lower bound or transpose the array beforehand.

$.02 -Ron Shepard
.



Relevant Pages

  • Re: Arrays sharing memory?
    ... confusions caused by implicit double precision. ... Also, if you are mixing arrays with lower bounds of 0 and 1, it is easy ... referencing an element 0 when the lower bound is 1 also counts ... changed to 4 within subroutine) and ncompg are ...
    (comp.lang.fortran)
  • Re: enhance an arrays static type by a lower length-bound.
    ... to specify such a lower bound in a type signature. ... signature occurs at compile time while you might only learn the real ... the Class-instances representing arrays e.g. for a call to ... cast in the second line, and the cast would mean that a runtime check ...
    (comp.lang.java.programmer)
  • Re: Array size limit ?
    ... Single dimension Zero based arrays (sometimes called vectors or ... The SZArray has a lot more functionality including sort, ... Both VB6 and VB.NET do bounds ... So for VB6 has to get the lower bound add the length to ...
    (microsoft.public.vb.general.discussion)
  • Re: unique values in an array
    ... unfortunates need only read the description of ArrayUniques in the ... In both cases you start off with 0-based 1D arrays and convert them ... 'convert single area ranges to arrays; ... 'keep original 2nd dim'n lower bound, ...
    (microsoft.public.excel.programming)
  • Re: yet another another wish list
    ... C# and Oberon only support zero-based arrays ... By new programmers, I mean programmers whose first introduction to ... of an arbitrary lower bound hardly provides any additional expressive power. ...
    (borland.public.delphi.non-technical)