Vesa,
Officially, there is no guarantee placed on the order of compound
members. In fact 1.8.3 would always try to keep the members sorted by
offset. However, this caused some problems due to the design of the
H5TB API, so it was reverted in 1.8.4 to keep the fields in insertion
order in the cases that matter to H5TB. Exceptions to this are: use of
H5Tpack, and when a datatype is used for type conversion. The library
will sort datatypes by offset in both of these cases. Again, beware
that the reference manual states that the members "are stored in no
particular order".
Your observations about compound type sizes are correct. I believe the
statement about compound types being a "fixed size" was to differentiate
them from variable-length types, where each individual element can have
a differing size.
Thanks,
-Neil Fortner
On 12/18/2009 03:09 PM, Vesa Paatero wrote:
Hello,
Something I couldn't find clearly said in documentations: Can you rely on the
indexes of the fields in a compound to follow their insertion order? Like if I
first add field A to an empty compound and then field B, is A always in index
position 0 and B in position 1? Maybe that is something that has not been
declared official so that it can be changed in future releases if needed?
Thanks for any words of wisdom on this.
Another note: The documentations say that compound datatypes have a fixed size. However,
I have successfully used compounds so that when building a compound I increase its size
before every insertion of a field (using H5Tset_size) according to the size of the
field. But I guess the point in term "fixed size" is that once a compound has
been used it cannot be changed.
Best Regards,
Vesa Paatero
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org