(j3.2006) elem_len argument to CFI_allocate

Bill Long longb
Wed Aug 10 18:54:56 EDT 2011


We have an elem_len argument to the CFI_allocate routine that is used 
only for a Character type.   However, this would seem relevant only if 
we are supporting a deferred length character, as in

Case 1:

character(:),allocatable :: c(:)
...
allocate (character(20) :: c(10000) )

in which case the element length is not known until the allocation takes 
place.

If, on the other hand, we have the case of

Case 2:

character(20),allocatable :: c(:)
...
allocate (c(10000) )

then we are not allowed to change the character length as part of the 
allocation.

But for the second case, the elem_len would already have been set in the 
CFI_establish call, or in the caller for the case of a dummy argument.

If we really intended to support Case 1, then we need to say that the 
value of elem_len specified in CFI_establish is some flag value, like 
-1, so it is distinguishable from the constant character length case. 
And the argument association rules need some work.

On the other hand, if we are not supporting Case 1, then the elem_len 
value specified in the argument list has to match the value already in 
the C descriptor or there is an error. In which case, it would be better 
to just eliminate the elem_len argument from CFI_allocate.

Questions:

1) Have I missed an important case here?

2) Did we intend to support Case 1?

3) If no to 1 and 2, do we need the elem_len argument to CFI_allocate?


Cheers,
Bill




-- 
Bill Long                                           longb at cray.com
Fortran Technical Support    &                 voice: 651-605-9024
Bioinformatics Software Development            fax:   651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101





More information about the J3 mailing list