Andrey,
it turns out you were correct. I run a simple test
#include <hdf5.h>
#include <stddef.h>
int main(int argc, char const *argv[])
{
printf("sizeof(H5G_storage_type_t) = %ld\n", sizeof(H5G_storage_type_t));
printf("sizeof(H5G_info_t) = %ld\n", sizeof(H5G_info_t));
printf("offsetof(H5G_info_t, storage_type) = %ld\n", offsetof(H5G_info_t,
storage_type));
printf("offsetof(H5G_info_t, nlinks) = %ld\n", offsetof(H5G_info_t,
nlinks));
printf("offsetof(H5G_info_t, max_corder) = %ld\n", offsetof(H5G_info_t,
max_corder));
printf("offsetof(H5G_info_t, mounted) = %ld\n", offsetof(H5G_info_t,
mounted));
return 0;
}
and obtained the following output:
sizeof(H5G_storage_type_t) = 4
sizeof(H5G_info_t) = 32
offsetof(H5G_info_t, storage_type) = 0
offsetof(H5G_info_t, nlinks) = 8
offsetof(H5G_info_t, max_corder) = 16
offsetof(H5G_info_t, mounted) = 24
It's an alignment problem.
Andrea
On 6 May 2014 14:57, Андрей Парамонов <[email protected]> wrote:
> 06.05.2014 3:22, Andrea Bedini пишет:
>
> I don't think it's an alignment problem. I think this happens
>> because H5G_storage_type_t is an enum and the size of an enum in C is
>> not fixed (although is guaranteed to be big enough to contain an int).
>>
>> See e.g.
>> http://stackoverflow.com/questions/366017/what-is-the-
>> size-of-an-enum-in-c
>>
>
> Thank you for your comment!
>
> Could someone with working C compiler at hand please check the sizes of
> H5G_storage_type_t and H5G_info_t, and also check whether using alignas(1)
> changes anything?
>
>
> Best wishes,
> Andrey Paramonov
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
> _______________________________________________
> Hdf-forum is for HDF software users discussion.
> [email protected]
> http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-
> forum_lists.hdfgroup.org
>
--
Andrea Bedini <[email protected]>
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org