diff options
author | David Young <dyoung@hdfgroup.org> | 2019-11-13 19:29:59 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2020-05-20 14:19:37 (GMT) |
commit | 224653db64c722ed9f97586d9084b1a1dba2f4b5 (patch) | |
tree | a84ed142f1ce5c6263b0ae727bc64f57326b2733 /src | |
parent | 386138daa3ce515296602028846274a7579685ef (diff) | |
download | hdf5-224653db64c722ed9f97586d9084b1a1dba2f4b5.zip hdf5-224653db64c722ed9f97586d9084b1a1dba2f4b5.tar.gz hdf5-224653db64c722ed9f97586d9084b1a1dba2f4b5.tar.bz2 |
Change hdset_reg_ref_t and H5R_ref_t from arrays of unsigned char to
structs containing those arrays. Encapsulating the arrays in this way
makes it easier to write and think about pointers to these types, casts
to/from these types, etc.
An interesting side-effect that we probably should *not* rely on is
that the struct-encapsulation changes the alignment so that some GCC
warnings about casts that increase the alignment requirement of the
operand go away. Warnings like that have to be taken seriously: I will
add -Werror=cast-align to the default compiler flags so that they stop
the build quickly.
GCC warnings led me to some surprising casts in test/trefer.c. I found
that it was possible to make many simplifications after introducing the
struct-encapsulation that I described, above.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Rpublic.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index ce54ac4..045e04a 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -70,14 +70,18 @@ typedef haddr_t hobj_ref_t; * machine (8 bytes currently) plus an int. * Note! This type can only be used with the "native" HDF5 VOL connector. */ -typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE]; +typedef struct { + unsigned char content[H5R_DSET_REG_REF_BUF_SIZE]; +} hdset_reg_ref_t; /** * Opaque reference type. The same reference type is used for object, * dataset region and attribute references. This is the type that * should always be used with the current reference API. */ -typedef unsigned char H5R_ref_t[H5R_REF_BUF_SIZE]; +typedef struct { + unsigned char content[H5R_REF_BUF_SIZE]; +} H5R_ref_t; /********************/ /* Public Variables */ |