Re: Why scalar /= dimension(1)) ? for intent(inout) dummy arg
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: Why scalar /= dimension(1)) ? for intent(inout) dummy arg         

Group: comp.lang.fortran · Group Profile
Author: Gordon Sande
Date: Aug 3, 2007 07:33

On 2007-08-03 11:01:00 -0300, glen herrmannsfeldt ugcs.caltech.edu> said:
> Paul van Delst wrote:
>
> (snip)
>
>> Two good general rules (that, yes, don't address every case under the
>> sun), regardless of the argument INTENT, for argument dimensionality
>> are:
>
>> 1) If your dummy argument is an array, your actual argument must be an array.
>> 2) If your dummy argument is a scalar, your actual argument must be a scalar.
>
>> Quite simple really. Don't mix ranks (or types, or kinds) of your
>> dummy/actual args and you'll be set.
>
> and:
>
> 1b) If your dummy argument is an assumed size array, the actual argument
> must be an array or array element.

Explicit size is also OK. The easy to forget special case of assumed size.
> 2b) If your dummy argument is a scalar, your actual argument
> can be an array element.

How about:

an array element is a scalar

except in the case of the dummy arguement is an assumed or explicit size
array and the user is both rather knowledgable and using some old F77
"tricks of the trade" when it is treated as an array under sequence
association rules.

The exception is a common F77 storeage allocation method that often
appears in legacy code but is no longer a recommended programming style.
If one needs some terminology one might say that this method is using
array elements to provide "offset arrays". It is like the usage of
the array section x(i:) to have the array start with element i except
there was not any syntax or notion to desribe it in F77 other than
sequence association.
no comments
diggit! del.icio.us! reddit!