From a7d55c479d804e3214b83030f11e7e2775ed2210 Mon Sep 17 00:00:00 2001 From: David Young Date: Thu, 10 Mar 2022 09:06:32 -0600 Subject: Briefly explain alignments_t. --- src/H5Tnative.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- cgit v0.12