[MPI3 Fortran] Fortran extra_state argument to MPIattributefunctions

N.M. Maclaren nmm1 at cam.ac.uk
Thu May 28 15:36:36 CDT 2009


On May 28 2009, Aleksandar Donev wrote:
>
>> Using tokens for such things 
>> has major software engineering advantages, not least because you can 
>> check them for validity (e.g. scoping errors) before use.
>
>Except that *integers* are the wrong way to do that! If they were, we 
>would call them "tokens" and not "integers". Sets are sets, and integers 
>are some particular set which has, for example, addition attached to it, 
>something tokens probably not ought to.

Oh, yes, I agree.  Opaque types would be better.

>> Even in C, 
>> checking arbitrary pointer values for validity relies on undefined 
>> behaviour.
>
> Correct, and languages more modern than C, including Fortran 2003, have a 
> good (maybe not the best) way to do "checked" pointers, namely, using 
> "CLASS(...), POINTEr". These are (partially) typed, and can only be 
> pointed to things of the right type and with the TARGET attribute, but 
> are also extensible. You can make them act like integers and thus be even 
> more checkable (for example, restricted to a small finite set of possible 
> values), or TYPE(C_PTR) (an address), according to your desires. Instead 
> of forcing everyone to use integers just because that happens to be the 
> one single intrinsic type that can be used to index a set.

But can they handle the scoping issue?

>But the point here is to find something for MPI. In most MPI codes, I am 
>sure people will not check the integer handles and in fact simply do 
>illegal things like Jeff mentioned: pass the first element of an array 
>and that way later refer to the whole array. Also, the C interface 
>already uses void*, and trying to do "better" than that seems pointless. 
>I though the decision was not to "modernize" the MPI interface but 
>rather try to emulate the C interface as closely as possible.

Ugh.

Jeff Squyres has responded to this one, and I think that we should follow
up on that.


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  nmm1 at cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679




More information about the mpiwg-fortran mailing list