> Many C compilers play games with the ordering of data elements within a
> structure as a means of packing data (such as grouping all the char`s together
> at the end of the structure). The ANSI C specification specifically says that
> they make no assumptions about how the compiler implements a C structure,
> except that it must not start or end with a "hole."
False.
This is simply an incorrect statement. I don't have a copy of the
standard to hand, but I'm absolutely certain that
1) You can't start with a hole
2) The compiler is *not* allowed to re-order structure members
3) You *can* end with a hole. (Indeed this is very common).
However the point being made is correct. It's impossible for MPI to
know enough about the layout of a structure to be able to transfer it
without you telling it in detail (i.e. down to the byte offsets of the
structure components), because the properties of structure layout can
depend on not only the target machine, but also
1) the compiler
2) compile time flags to the compiler
3) #pragma directives associated with the structure definition.
Since the MPI library can see none of these properties, it cannot
possibly determine the structure layout.
Of course, as soon as you detail the layout of the structure, then you
need different versions on heterogeneous machines (or even when you
transfer data in a homeogenous environment between structures compiled
with different options...)
-- Jim
James Cownie
BBN UK Ltd
Phone : +44 117 9071438
E-Mail: jcownie@bbn.com