long long type support

Hello there,

Does anyone know if and how HDF5 library handles 'long long' data in
following situations...

a. data is generated/written from an executable where
   sizeof(long long)=8 and later read into an executable where
   sizeof(long long)=4

b. The inverse situation of a. Thats MUCH easier but I need to ask.

I am thinking that item a. could result either in some kind of error or
perhaps only error when data being read is outside range of a 4 byte
int.

Mark

···

--
Mark C. Miller, Lawrence Livermore National Laboratory
email: mailto:miller86@llnl.gov
(M/T/W) (925)-423-5901 (!!LLNL BUSINESS ONLY!!)
(Th/F) (530)-753-8511 (!!LLNL BUSINESS ONLY!!)

Hello Mark,

A Tuesday 20 October 2009 23:46:35 Mark Miller escrigué:

a. data is generated/written from an executable where
   sizeof(long long)=8 and later read into an executable where
   sizeof(long long)=4

Can you tell us in which platform sizeof(long long)=4? Just curious.

···

--
Francesc Alted

Hi Mark,

···

On Oct 20, 2009, at 4:46 PM, Mark Miller wrote:

Hello there,

Does anyone know if and how HDF5 library handles 'long long' data in
following situations...

a. data is generated/written from an executable where
  sizeof(long long)=8 and later read into an executable where
  sizeof(long long)=4

b. The inverse situation of a. Thats MUCH easier but I need to ask.

I am thinking that item a. could result either in some kind of error or
perhaps only error when data being read is outside range of a 4 byte
int.

  The HDF5 library will definitely handle both situations. For situations like (a), you can register a callback for various overflow situations during the I/O operation with the H5Pset_type_conv_cb() routine.

  Quincey

Sorry, meant just 'long'.

Mark

···

On Wed, 2009-10-21 at 00:09, Francesc Alted wrote:

Hello Mark,

A Tuesday 20 October 2009 23:46:35 Mark Miller escrigu�:
> a. data is generated/written from an executable where
> sizeof(long long)=8 and later read into an executable where
> sizeof(long long)=4

Can you tell us in which platform sizeof(long long)=4? Just curious.

--
Mark C. Miller, Lawrence Livermore National Laboratory
email: mailto:miller86@llnl.gov
(M/T/W) (925)-423-5901 (!!LLNL BUSINESS ONLY!!)
(Th/F) (530)-753-8511 (!!LLNL BUSINESS ONLY!!)

A Wednesday 21 October 2009 12:01:11 Mark Miller escrigué:

Sorry, meant just 'long'.

Ah... Well, what I normally use for dealing with this is the
H5Tget_native_type() call, followed by a:

itemsize = H5Tget_size(native_tid)

once you know the itemsize, you know which type you should map with.

Another possibility is to use 'standard' HDF5 types, i.e. something like:

#define H5T_STD_I32LE
#define H5T_STD_I64LE

so that you always know the size of the type you are writing.

I prefer to use the former approach, but I suppose the latter could be useful
too in some scenarios.

HTH,

···

--
Francesc Alted

A Wednesday 21 October 2009 13:02:37 Francesc Alted escrigué:

Another possibility is to use 'standard' HDF5 types, i.e. something like:

#define H5T_STD_I32LE
#define H5T_STD_I64LE

Sorry, I meant the *symbols*

H5T_STD_I32LE
H5T_STD_I64LE

···

--
Francesc Alted

Hi Francesc,

Yes, I knew what you meant. I was/am trying to avoid the size-specific
variants as that requires more knowledge about the compilation scenario.
But, I agree the approach you describe would work ok.

Mark

···

On Wed, 2009-10-21 at 04:22, Francesc Alted wrote:

A Wednesday 21 October 2009 13:02:37 Francesc Alted escrigu�:
> Another possibility is to use 'standard' HDF5 types, i.e. something like:
>
> #define H5T_STD_I32LE
> #define H5T_STD_I64LE

Sorry, I meant the *symbols*

H5T_STD_I32LE
H5T_STD_I64LE

--
Mark C. Miller, Lawrence Livermore National Laboratory
email: mailto:miller86@llnl.gov
(M/T/W) (925)-423-5901 (!!LLNL BUSINESS ONLY!!)
(Th/F) (530)-753-8511 (!!LLNL BUSINESS ONLY!!)