Skip to content

Commit 438c2f8

Browse files
avargitster
authored andcommitted
CodingGuidelines: recommend against unportable C99 struct syntax
Per 33665d9 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d7d850e commit 438c2f8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Documentation/CodingGuidelines

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,11 @@ For C programs:
242242
printf("%"PRIuMAX, (uintmax_t)v). These days the MSVC version we
243243
rely on supports %z, but the C library used by MinGW does not.
244244

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+
245250
- Variables have to be declared at the beginning of the block, before
246251
the first statement (i.e. -Wdeclaration-after-statement).
247252

0 commit comments

Comments
 (0)