While the empty one is more correct, {0} will also work, and will
likely silence diagnostics in old compiler versions.
Empty compound literals are only supported in GCC since commit
gcc.git
14cfa01755a6 (2022-08-25; "c: Support C2x empty initializer braces")
Reported-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
\
int status; \
\
- *n_ = _Generic((T){}, \
+ *n_ = _Generic((T){0}, \
short: strtoi_, \
int: strtoi_, \
long: strtoi_, \
#define CMP(T) \
( \
- _Generic((T){}, \
+ _Generic((T){0}, \
int: cmp_int, \
long: cmp_long, \
unsigned int: cmp_uint, \
#include <sys/types.h>
-#define typeas(T) typeof((T){})
+#define typeas(T) typeof((T){0})
#define ssizeof(x) ({(ssize_t){sizeof(x)};})
#define memberof(T, member) ((T){}.member)
#define QChar_of(s) typeof \
( \
_Generic(s, \
- const char *: (const char){}, \
- const void *: (const char){}, \
- char *: (char){}, \
- void *: (char){} \
+ const char *: (const char){0}, \
+ const void *: (const char){0}, \
+ char *: (char){0}, \
+ void *: (char){0} \
) \
)