CodingGuidelines: recommend against unportable C99 struct syntax

Per 33665d98e6b (reftable: make assignments portable to AIX xlc v12.01, 2022-03-28) forms like ".a.b = *c" can be replaced by using ".a = { .b = *c }" instead. We'll probably allow these sooner than later, but since the workaround is trivial let's note it among the C99 features we'd like to hold off on for now. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Oct 10, 2022 at 13:38 UTC 438c2f859b2c8c01c57a6969ec5858c0253cfa69
1 file changed +5
Documentation/CodingGuidelines
+5
@@ -242,6 +242,11 @@ For C programs:
242 printf("%"PRIuMAX, (uintmax_t)v). These days the MSVC version we
243 rely on supports %z, but the C library used by MinGW does not.
244
245 + . Shorthand like ".a.b = *c" in struct initializations is known to
246 + trip up an older IBM XLC version, use ".a = { .b = *c }" instead.
247 + See the 33665d98 (reftable: make assignments portable to AIX xlc
248 + v12.01, 2022-03-28).
249 +
250 - Variables have to be declared at the beginning of the block, before
251 the first statement (i.e. -Wdeclaration-after-statement).
252