Filed order in compound type

Hi,

quick qestion on the compound types. For some reason I had an
impression that compound types can match their fields by the
filed name and the order of the fields (and the number) does
not really matter. I re-read the User's Guide and there it
explicitely states (In Data Transfer section):

  The name and order of the fields must be the same in the source
  and the destination but the source and destination may have
  different alignments of the fields, and only some of the fields
  might be transferred.

It seems that my assumption is not correct. What should happen now
when source and destination types have the same fields but ordered
differently? Do we get any error or does it silently skip fileds?

Thanks,
Andy

Hi Andrei,

We need to check our UG :wink: I think your assumption is correct.

We even have a test (see test/cmpd_dset.c) that writes fields in one order and then reads them into a data structure that has a reversed order of the members (structures s1_t and s3_t for reference).

Elena

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Oct 24, 2013, at 1:25 PM, "Salnikov, Andrei A." <salnikov@slac.stanford.edu> wrote:

Hi,

quick qestion on the compound types. For some reason I had an
impression that compound types can match their fields by the
filed name and the order of the fields (and the number) does
not really matter. I re-read the User's Guide and there it
explicitely states (In Data Transfer section):

The name and order of the fields must be the same in the source
and the destination but the source and destination may have
different alignments of the fields, and only some of the fields
might be transferred.

It seems that my assumption is not correct. What should happen now
when source and destination types have the same fields but ordered
differently? Do we get any error or does it silently skip fileds?

Thanks,
Andy

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Hi Elena,

thanks, that’s a relief.

Cheers,
Andy

···

From: Hdf-forum [mailto:hdf-forum-bounces@lists.hdfgroup.org] On Behalf Of Elena Pourmal
Sent: Thursday, October 24, 2013 4:54 PM
To: HDF Users Discussion List
Subject: Re: [Hdf-forum] Filed order in compound type

Hi Andrei,

We need to check our UG :wink: I think your assumption is correct.

We even have a test (see test/cmpd_dset.c) that writes fields in one order and then reads them into a data structure that has a reversed order of the members (structures s1_t and s3_t for reference).

Elena
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Oct 24, 2013, at 1:25 PM, "Salnikov, Andrei A." <salnikov@slac.stanford.edu<mailto:salnikov@slac.stanford.edu>> wrote:

Hi,

quick qestion on the compound types. For some reason I had an
impression that compound types can match their fields by the
filed name and the order of the fields (and the number) does
not really matter. I re-read the User's Guide and there it
explicitely states (In Data Transfer section):

The name and order of the fields must be the same in the source
and the destination but the source and destination may have
different alignments of the fields, and only some of the fields
might be transferred.

It seems that my assumption is not correct. What should happen now
when source and destination types have the same fields but ordered
differently? Do we get any error or does it silently skip fileds?

Thanks,
Andy

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org