CodingGuidelines: recommend against unportable C99 struct syntax

Per 33665d98e6 (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>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2022-10-10 13:38:00 -07:00 committed by Junio C Hamano
parent d7d850e2b9
commit 438c2f859b

View File

@ -242,6 +242,11 @@ For C programs:
printf("%"PRIuMAX, (uintmax_t)v). These days the MSVC version we
rely on supports %z, but the C library used by MinGW does not.
. Shorthand like ".a.b = *c" in struct initializations is known to
trip up an older IBM XLC version, use ".a = { .b = *c }" instead.
See the 33665d98 (reftable: make assignments portable to AIX xlc
v12.01, 2022-03-28).
- Variables have to be declared at the beginning of the block, before
the first statement (i.e. -Wdeclaration-after-statement).