Tiny tip for maintaining HDF5 dependent code across versions

Hi All,

I thought this might be useful to others writing HDF5 client code (and I
was hoping HDF5 might put it into their header file :wink: and trying to
ensure that it compiles across a wide variety of versions of HDF5. Whit
this macro...

/* useful macro for comparing HDF5 versions */
#define H5_VERSION_GE(Maj,Min,Rel) \
        (((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR==Min) && (H5_VERS_RELEASE>=Rel)) || \
         ((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR>Min)) || \

you can write code blocks like...

/* For something that entered HDF5 at a given version */
#if H5_VERSION_GE(1,4,2)
/* version 1.4.2 and greater code */


/* for something that only existed for a few versions of HDF5 */
#if H5_VERSION_GE(1,6,0) && !H5_VERSION_GE(1,6,2)
/* version 1.6 through 1.6.2 specific code



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!!)