[J3] Lower bound of an allocatable array function result
Vipul Parekh
parekhvs at gmail.com
Fri Jun 14 23:39:54 EDT 2019
On Fri, Jun 14, 2019 at 7:34 PM Malcolm Cohen via J3 <
j3 at mailman.j3-fortran.org> wrote:
> The standard clearly says that the result of LBOUND of any array function
> reference is 1.
>
> Just read the words guys!
>
> The only case where LBOUND can return anything other than one is when
> ARRAY is a “whole array”. Which is conveniently hyperlinked to the
> definition of the term “whole array” as “array component or array name
> without further qualification”. QED.
>
Ok so my takeaway here is to start searching in the standard for what one
is looking for e.g., search for LBOUND when one wants to know what LBOUND
will return under a particular situation, DUH to self! :-)
Except that in this circumstance, I doubt I could have figured out a useful
response for Jon.
Note 18-007r1 states under p5 Case(i) for LBOUND, "If DIM is present, ARRAY
is a whole array, and either ARRAY is an assumed-size array of rank DIM or
dimension DIM of ARRAY has nonzero extent, the result has a value equal to
the lower bound for subscript DIM of ARRAY. Otherwise, if DIM is present,
the result value is 1." This last sentence can raise more questions than
it answers, I think.
Now 10-007r1 had instead, "If ARRAY is a whole array and either ARRAY is an
assumed-size array of rank DIM or dimension DIM of ARRAY has nonzero
extent, LBOUND (ARRAY, DIM) has a value equal to the lower bound for
subscript DIM of ARRAY. Otherwise the result value is 1."
A quick search at the J3 site suggests papers such as J3/14-106 might have
led to edits to the first sentence. But I couldn't locate any paper behind
the change to the second sentence in 18-007r1. Can anyone point me to it?
The blurb in 10-007r1 appears clearer to me.
Thanks,
Vipul Parekh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20190614/9defd63c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20190614/9defd63c/attachment-0001.gif>
More information about the J3
mailing list