[MPI3 Fortran] Proposing changes to Fortran 2008
Craig Rasmussen
crasmussen at lanl.gov
Thu Mar 20 10:35:52 CDT 2008
On Mar 20, 2008, at 9:19 AM, Jeff Squyres wrote:
> On Mar 20, 2008, at 11:13 AM, Craig Rasmussen wrote:
>> Yes, but the same size hole would exist for the "companion" C struct
>> as well. So however you calculate stride information for C would
>> work for an interoperable derived type in Fortran as well. Suppose
>> foo were,
>>
>> struct foo {
>> char a;
>> char b;
>> int i;
>> char c;
>> char d;
>> }
>
> Ok, but you said everything in Fortran had to be contiguous. With a
> hole, by definition, it's not contiguous (and, per my other mails, you
> can be much more arbitrary, such as skipping the "b" field in the
> struct above). Does Fortran have a different definition of
> "contiguous" than C? :-)
Doesn't Fortran have a different definition of everything? :-)
An object is contiguous if it is one of several things, including "an
array allocated by an ALLOCATE statement." Thus an array of foos
(that sounds cool) will be contiguous. That is what I have been
meaning. Obviously since foo has two or more elements, successive
elements foo.a in the array are not contiguous.
>
>> Don't you have to worry about the C compiler reordering the elements
>> of foo?
>
> With C++, perhaps. With C, no.
Hum, is there someplace you can direct me to that states that
elements of C structs may not be reordered? I had thought otherwise.
Craig
More information about the mpiwg-fortran
mailing list