]> git.ipfire.org Git - thirdparty/git.git/commitdiff
CodingGuidelines: recommend against unportable C99 struct syntax
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Mon, 10 Oct 2022 20:38:00 +0000 (13:38 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 11 Oct 2022 15:55:01 +0000 (08:55 -0700)
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>
Documentation/CodingGuidelines

index 9598b45f7e0bafe7e1b19b6325c1fb4ae36ba979..1d95a142b2780ad27636d3657d37f2608e9ac968 100644 (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).