+2019-05-24 Paul Eggert <eggert@cs.ucla.edu>
+
+ flexmember: update comment
+ * m4/flexmember.m4 (AC_C_FLEXIBLE_ARRAY_MEMBER): Improve comment.
+
2019-05-20 Bruno Haible <bruno@clisp.org>
setlocale: Improve fallback on macOS.
AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [],
[Define to nothing if C supports flexible array members, and to
1 if it does not. That way, with a declaration like 'struct s
- { int n; double d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack
+ { int n; char d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack
can be used with pre-C99 compilers.
- When computing the size of such an object, don't use 'sizeof (struct s)'
- as it overestimates the size. Use 'offsetof (struct s, d)' instead.
+ Use 'FLEXSIZEOF (struct s, d, N)' to calculate the size in bytes
+ of such a struct containing an N-element array, as both
+ 'sizeof (struct s) + N * sizeof (char)' and
+ 'offsetof (struct s, d) + N * sizeof (char)'
+ might compute a size that can cause malloc to align storage
+ improperly, even in C11.
Don't use 'offsetof (struct s, d@<:@0@:>@)', as this doesn't work with
MSVC and with C++ compilers.])
else