Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
snprintb (Was: CVS commit: src)
On Thu, Oct 09, 2025 at 18:51:41 +0000, Roland Illig wrote:
> Module Name: src
> Committed By: rillig
> Date: Thu Oct 9 18:51:41 UTC 2025
>
> Modified Files:
> src/common/lib/libutil: snprintb.c
> src/lib/libutil: snprintb.3
> src/tests/lib/libutil: t_snprintb.c
>
> Log Message:
> libutil/snprintb: allow 'f' to be combined with ':'
>
> But only if the numeric value can be clearly distinguished from the
> description. This style is used by sh3/dmacreg.h.
In my emphatically not so humble opinion, this is _not_ the behavior
we want for snprintb. Please, just revert to the previous state, as
it was before your attempts to make this code "helpful".
As I wrote in my initial round of objections:
Now, bugs happen. Unlike gcc warnings about printf format mismatch
that are presented to the author of the code, the above will be
shown to a user that was told to run something with debug enabled,
but, alas, the author made a mistake and now snprintb's refusal to
deal with it b/c of abstract truth might lead itstead to a very real
blues. That error condition that is so hard to reproduce hit, but
b/c of a mistake in the snprintb format it's all in vain...
To use a hyperbole, your change to snprintb is akin to changing
printf() so that
printf("hello, world\n");
prints
#
because hello is not capitalized at the beginning of the sentence.
With no way for the author of the code to know about that at compile
time (unlike say gcc printf format mismatch warnings).
The old beahvior is very simple and procedural and easy to understand.
I also provided an F/= example that IMO is perfectly legitimate.
I fail to see how your change helps any use case (an author that is
expected to see the # from your implementation can equally well see
the weird looking formatting anyway - both events happen at the same
moment in the program's live cycle), and I have provided an example of
how your change is actively harmful is some cases b/c it refuses to
print stuff that "doesn't look nice". This is fundamentally wrong.
-uwe
Home |
Main Index |
Thread Index |
Old Index