summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2022-03-10 15:06:32 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2022-03-10 15:06:32 (GMT)
commita7d55c479d804e3214b83030f11e7e2775ed2210 (patch)
tree067665558e27019b014125ad2c88215694e862a5 /src
parentaf884602f07103e7826a0aa3a6cf7cf8b7c8d9df (diff)
downloadhdf5-a7d55c479d804e3214b83030f11e7e2775ed2210.zip
hdf5-a7d55c479d804e3214b83030f11e7e2775ed2210.tar.gz
hdf5-a7d55c479d804e3214b83030f11e7e2775ed2210.tar.bz2
Briefly explain alignments_t.
Diffstat (limited to 'src')
-rw-r--r--src/H5Tnative.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index 6dc5ea0..4567fe5 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -975,6 +975,14 @@ get_host_byte_order(void)
herr_t
H5T__init_native_int(void)
{
+ /* Here we construct a type that lets us find alignment constraints
+ * without using the alignof operator, which is not available in C99.
+ *
+ * Between each sub-struct's `char` member `c` and member `x`, the
+ * compiler must insert padding to ensure proper alignment of `x`.
+ * We can find the alignment constraint of each `x` by looking at
+ * its offset from the beginning of its sub-struct.
+ */
typedef struct {
struct {
char c;