(j3.2006) (SC22WG5.4007) [ukfortran] NOT on Paper 09-238

N.M. Maclaren nmm1
Thu Jun 11 15:21:29 EDT 2009


On Jun 11 2009, Aleksandar Donev wrote:
>
>>     2) With a defined null value (i.e. like NULL())
>
>But that is not a C address, is it? It is a value, for sure.

God alone knows.  Despite 1.3.19 in Fortran, there is no well-defined
meaning of 'address' in C.

>> (3) and (4) are merely a different way of pointing
>> to valid objects.  We experts know that Fortran has no equivalent
>> feature, so interoperability is implausible.
>
>C_F_POINTER is not about *direct* interoperability. It is about 
>converting a C pointer to a Fortran pointer, so it is perfectly 
>reasonable to allow one to obtain a Fortran pointer to some C object, 
>such as the incomplete array at the end of some structure.

Yeah.  So you end up getting a valid Fortran pointer to something that
uisn't a valid Fortran target :-(

>> But WHERE in the standard is that made clear?
>
>No where, but it seems to me if one goes in such details C_F_POINTER has 
>much bigger problems, notably, there are no stated restrictions on 
>SHAPE. For example, if you have a C array of size 10, and a pointer to 
>the middle of it (say element index 5), what is allowed for SHAPE? This 
>would seem more basic than asking what is allowed if the C pointer is 
>the address of the end of an structure with an incomplete array at the 
>end or if it points to the element one past the end of an array.

Oh, THAT's not a problem.  Both languages have compatible concepts of
sequence association (though C's is not called that, of course).


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 J3 mailing list