Pádraig Brady <[email protected]> writes:

> On 18/09/2025 22:30, Bruno Haible wrote:
>> On FreeBSD 11, I see this warning:
>> ../src/ln.c:383:35: warning: data argument not used by format string
>> [-Wformat-extra-args]
>> The code there passes two string arguments and uses
>>    - sometimes both,
>>    - sometimes only the first one,
>>    - sometimes only the second one, with "%.0s" to skip and ignore
>>      the first one.
>> Especially the latter trick can cause confusion among translators.
>> If possible, it should therefore be avoided.
>> Here's a patch that eliminates the warning and the use of "%.0s".
>> The result is somewhat bigger but just as maintainable (at least)
>> than the previous code.
>> 
> Queued for next release

Thanks for the cleanup Bruno.

Outside of the point you mentioned, nested ternary operators can get
messy pretty quickly. So I think they are probably best avoided where
possible. One place, for example, they can't be avoid is the intprops.h
macros. I guess statement expressions would clean those up, but it is a
GNU C extension [1].

Collin

[1] https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html

Reply via email to