RE: cb/pedantic-build-for-developers, POSIX-but-not-C99 and -Wno-pedantic-ms-format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On September 22, 2021 12:13 PM, Junio C Hamano:
>Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes:
>
>> I.e. complaining about "%m$" instead of "%" in printf formats, it's
>> easy enough to fix in my case, it's just something I used to
>> de-duplicate a rather complex format, this makes it C(89|99)-compliant:
>>
>>     -       strbuf_addf(&fmt, "%%s%%s%%s-%%0%1$lud.%%0%1$lud-%%s-%%s-%%s",
>>     -                   (unsigned long)tmp.len);
>>     +       strbuf_addf(&fmt, "%%s%%s%%s-%%0%lud.%%0%lud-%%s-%%s-%%s",
>>     +                   (unsigned long)tmp.len, (unsigned long)tmp.len);
>>
>> But in general, do we view -pedantic as an implicit endorsement that
>> we should be using less POSIX and more standard C than we otherwise would?
>>
>> I may be wrong, but I believe that construct is widely portable, we
>> don't use it in the main source, but in the po/ files (so anything
>> that uses git + gettext tests for this already):
>
>Reordering (_("%s %s"), a, b) to ("%2$s %1$s", a, b) is essential to make po/ work.
>
>While I do not think of a reason why it should not work, I am not sure duplicating (%1$s %1$s", a) falls into the same category.
>
>Any solution that makes the per-cent ridden format string is better

Positional parameters do not work on all POSIX platforms. Please do not do this. NonStop will be locked out of future git releases.

Sincerely,
Randall




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux