diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-10-10 13:38:00 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-10-11 08:55:01 -0700 |
commit | 438c2f859b2c8c01c57a6969ec5858c0253cfa69 (patch) | |
tree | d368331041ba9a09d47f324053d271225004c6d5 /Documentation/CodingGuidelines | |
parent | d7d850e2b979c2063a7b39c6554233a8af189f3e (diff) | |
download | git-438c2f859b2c8c01c57a6969ec5858c0253cfa69.tar.gz |
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>
Diffstat (limited to 'Documentation/CodingGuidelines')
-rw-r--r-- | Documentation/CodingGuidelines | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 9598b45f7e..1d95a142b2 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -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). |