C++ doesn't like the {0} initializer pattern when the first
field is not an integer, let's use the {} when __cplusplus is
defined.
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
#define STACK_ARRAY_SIZE 8
+#ifdef __cplusplus
+#define STACK_ARRAY_ZERO_INIT {}
+#else
+#define STACK_ARRAY_ZERO_INIT {0}
+#endif
+
#define STACK_ARRAY(type, name, size) \
- type _stack_##name[STACK_ARRAY_SIZE] = {0}; \
+ type _stack_##name[STACK_ARRAY_SIZE] = STACK_ARRAY_ZERO_INIT; \
type *const name = \
((size) <= STACK_ARRAY_SIZE ? _stack_##name : (type *)malloc((size) * sizeof(type)))