[fitsbits] top or bottom

Patrick Wallace ptw at star.rl.ac.uk
Thu May 4 04:06:45 EDT 2000


Stephen Walton <swalton at galileo.csun.edu> recently wrote:

> On Wed, 26 Apr 2000, Mark Calabretta clarified many issues with regard to
> top/bottom/array indexing...
>
>> ...the main difficulty in handling the CD array is that of
>> not knowing its size in advance.  In the FORTRAN implementation of WCSLIB,
>> for example, since FORTRAN doesn't have structs or pointers,

>A problem which, I can't resist pointing out, is solved by Fortran-90.

Perhaps I've misunderstood both Mark's original point and the Fortran 90
feature being demonstrated by Stephen, but wasn't the solution present in
earlier Fortrans, in the form of the "adjustable dimension" feature?  It
was certainly there in Fortran IV (ANSI X3.9-1966).

Adjustable dimension is where you can call a subroutine and pass it the
dimensions of an array which is also being passed:

             :
            REAL W(1000)
             :
            CALL SUB(W,5,7)
             :
            SUBROUTINE SUB(A,M,N)
            REAL A(M,N)
             :

The lack of adjustable dimension in C is a real nuisance.  You can get
round the difficulty in various ways (DIY array indexing using macros for
instance) but there are always disadvantages - the code is bound to be
less clear, for a start.

Patrick Wallace
____________________________________________________________________________
Starlink/HMNAO                                  Internet:  ptw at star.rl.ac.uk
Rutherford Appleton Laboratory                       Tel:    +44-1235-445372
Chilton, Didcot, Oxon OX11 0QX, UK                   Fax:    +44-1235-446667
____________________________________________________________________________



More information about the fitsbits mailing list