[MPI3 Fortran] Results of recent J3 Fortran meeting

Bill Long longb at cray.com
Thu Oct 21 12:24:27 CDT 2010



N.M. Maclaren wrote:
> On Oct 21 2010, Bill Long wrote:
>> I've lost track of the choice numbers, but if there is no need for 
>> characters other that C's char, then the simplest solution (for both the 
>> user and the TR) is to treat character arrays passed by descriptor like 
>> any other arrays passed by descriptor.  The type would be char, and the 
>> dimension information (dim[] member) corresponds to the Fortran 
>> dimensions. The elem_len field contains the array element length. 
>> Because sizeof(char) is 1, the character length parameter is equal to 
>> the elem_len value, so the character len value is directly available. 
> 
> It is also the least future-resistant, which is matter of considerable
> concern.
> 

Not really. The size of the array element in a character array will 
always have a known relationship to the number of characters in the 
variable.  For ASCII characters, the relationship is trivial (equal), 
but it we later wanted to add support for 32-bit characters, the factor 
of 4  is well known.  If the user only wants to move the data, then the 
only relevant value is the elem_len anyway.  If they want to cast the 
pointer to a local bigchar type, then one additional line, len = 
elem_len/4, trivially gets the length.  This is certainly simpler, and 
conceptually more acceptable, than adding dimensions and making believe 
that character variables are really arrays.   This is only 
future-resistant if the size of the future character representation is 
not an integer multiple of the size of char.  If that is the case, then 
far worse issues arise.

Cheers,
Bill

> 
> Regards,
> Nick Maclaren.
> 
> 
> _______________________________________________
> mpi3-fortran mailing list
> mpi3-fortran at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-fortran

-- 
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 mpiwg-fortran mailing list