Joerg Stiller wrote:
>the recent discussion about the association of zero-sized
>objects confused me a bit.
>
>M. Metcalf wrote:
>> ... the standard says, in the definition of ASSOCIATED,
>> that for zero-size arrays the result is false.
someone else already clarified this, but anyway: Mike was referring only to
the 2-argument form of ASSOCIATED, not the 1-argument form.
ASSOCIATED(A,B) asks whether A and B are associated in their entirety with
each other. The standard says that the answer to this question is always
.FALSE. for zero-sized arrays.
Yes, this does seem peculiar. Unfortunately, no answer would have been
completely useful and consistent with the rest of the zero-sized array
handling. (It's too ugly to go into the details of the various problems
here). The "consensus" was the .FALSE. was the least misleading answer.
>Oops! What about this:
>
> integer, pointer :: a(:), b(:)
> allocate(a(0))
> b => a
>
>Which of the following are true ?
>
> associated(a)
> associated(b)
> associated(b,a)
T T F
>And, what about
>
> size(a)
> size(b)
0 0
Basically, if you are using the 2-argument form of ASSOCIATED and zero-sized
arrays are a possibility, you need to handle the zero-sized case explicitly
yourself.
Cheers,
--
...........................Malcolm Cohen, NAG Ltd., Oxford, U.K.
([log in to unmask])
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|