Re: Bugs at my web site
From: glen herrmannsfeldt (gah_at_ugcs.caltech.edu)
Date: 01/20/04
- Previous message: Jason Nielsen: "Re: Seeking F90 compiler for P IV under Linux -- Lahey or Intel?"
- In reply to: Charles Russell: "Re: Bugs at my web site"
- Next in thread: Richard Maine: "Re: Bugs at my web site"
- Reply: Richard Maine: "Re: Bugs at my web site"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 20 Jan 2004 18:22:58 GMT
Charles Russell wrote:
> "*** Hendrickson" wrote
>>What you are refering to is called "sequence association" and it's
>>still a first class citizen in F2003.
> Was it actually in the written standard for f77 or earlier?
> Or was it just a part of fortran tradition?
Fortran 66 has:
"7.2.1.1.1 Array Element Successor Function and Value of a Subscript.
For a given dimensionality, subscript declarator, and subscript, the
value of a subscript pointing to an array element and the maximum
value a subscript might attain are indicated in Table 2. A subscript
expression must be greater than zero.
The value of the array element successor function is obtained by adding
one to the entry in the subscript value column. Any array element whose
subscript has this value is the successor to the original element. The
last element of the array is the one whose subscript value is the
maximum subscript value and has no successor element.
Table 2 Value of a Subscript
Dimensionality Subscript Subscript Subscript Maximum
Declarator Value Subs. Value
1 (A) (a) a A
2 (A,B) (a,b) a+A*(b-1) A*B
3 (A,B,C) (a,b,c) a+A*(b-1)+ A*B*C
A*B*(c-1)
a,b,c are subscript expressions
A,B,C are dimensions."
This seems to allow you to reference an array element with any
combination of subscripts that generate the same "Subscript
Value", though all subscript expressions must be greater
than zero.
Part of 8.4.2 "If a dummy argument of an external function is an array
name, the corresponding actual argument must be an array name or array
element name."
also in 8.4.2 "The actual arguments, which constitute the argument
list must agrees in order, number, and type with the corresponding
dummy arguments in the defining program."
Note that it does not mention that dimensionality must agree.
That specifically allows an array element to be passed to a
subprogram expecting an array. Then, in 10.1.3...
"If the actual argument is an array element name, the length of the
dummy argument array must be less than or equal to the length of the
actual argument array plus one minus the value of the subscript of
the array element."
This seems to be discussed in terms of dimensionality of one,
but also in subscript value. That, and the ones described
above, seem to imply that arrays are stored in the order
described by the array element successor function, and can
be referenced that way in subprograms. Note, though, that
in 7.2.1.1 Array Declarator...
"No array element name may contain a subscript that, during
execution of the executable program, assumes a value less than
one or larger than the maximum length specified in the array
declarator."
This would seem to exclude the popular (1) declarator, though
it does not exclude a dummy array declarator with a very large
number in it. For implementations that do bounds checking, this
could be important.
For EQUIVALENCE statements it is specifically allowed to refer
to an array with one subscript, and use the array element successor
function to determine which element is being described.
-- glen
- Previous message: Jason Nielsen: "Re: Seeking F90 compiler for P IV under Linux -- Lahey or Intel?"
- In reply to: Charles Russell: "Re: Bugs at my web site"
- Next in thread: Richard Maine: "Re: Bugs at my web site"
- Reply: Richard Maine: "Re: Bugs at my web site"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]