Re: [PATCH v2 5/5] CodingGuidelines: recommend against unportable C99 struct syntax
- From
Jeff King <peff@peff.net>
- Date
- Oct 11, 2022, 00:39 UTC
- Message-ID
- <Y0S7OO4ecpvsnbtT@coredump.intra.peff.net>
- In-Reply-To
- <xmqqlepnxl1f.fsf@gitster.g>
On Mon, Oct 10, 2022 at 05:26:36PM -0700, Junio C Hamano wrote:
Show 21 quoted lines
> Jeff King <peff@peff.net> writes:
>
> > On Mon, Oct 10, 2022 at 01:38:00PM -0700, Junio C Hamano wrote:
> >
> >> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> >> index 9598b45f7e..cbe0377699 100644
> >> --- a/Documentation/CodingGuidelines
> >> +++ b/Documentation/CodingGuidelines
> >> @@ -242,6 +242,10 @@ 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 assignments is known to trip
> >> + up an older IBM XLC version, use ".a = { .b = *c }" instead. See
> >> + the 33665d98e6b portability fix from mid-2022.
> >
> > FWIW, the use of the word "assignment" here left me scratching my head.
> > Reading 33665d98e6b, it is about struct initialization.
>
> Thanks, I missed that confusion in the new description. Perhaps
> another round of reroll would make the series polished enough?I read through the rest of it fairly lightly, but I didn't see have any other complaints (and the overall goal of documenting our use of compiler features is a great one).
-Peff