(j3.2006) Select Rank

Van Snyder Van.Snyder
Tue Feb 17 19:37:04 EST 2015

On Tue, 2015-02-17 at 23:27 +0000, Bill Long wrote:
> Does it really solve an existing problem?

This came up for me in a case involving an include file.

It had been doing things that only involved the entire array.  Then a
requirement came along to do things to individual elements (the first
element, in array element order, in particular).

The include file is used in places with different ranks, but
(necessarily) always the same name.  In this case, the entity whose rank
is selected would not be an assumed-rank entity.  So, presumably, the
processor would optimize away all but one branch in each of the included
instances.  Hopefully, we wouldn't prohibit a rank-3 branch of a SELECT
CASE construct if the <selector> is actually rank-one, and not assumed

The alternatives to a SELECT RANK construct in this case are:

1. Make separate include files, one for each rank, and change all the
INCLUDE statements.

2. A kludge involving C_LOC and C_F_Pointer.  The kludge requires F08
support, since F03 didn't allow arrays as arguments to C_LOC.  So the
kludge can't even be done without either F08 support, or SELECT RANK.

More information about the J3 mailing list