Thanks! This is nicer. christos
> On Oct 3, 2026, at 10:25 PM, Paul Eggert <[email protected]> wrote: > > On 2026-10-03 17:12, Christos Zoulas wrote: >> I kept the original size_t buflen (because snprintf takes a size_t argument), >> and then just cast the LHS of the if statement to (size_t) > > Although that would work and would pacify the compiler, the cast is tricky > and things would be nearly as tricky if it were a conversion instead of a > cast (because casts are too powerful). The business about -1 wrapping around > to SIZE_MAX is not always immediately obvious: I can still remember my > surprise when I discovered that the C standard does not guarantee that the C > expression (SIZE_MAX == -1) is true. > > It's OK to use size_t for the buffer size, though, so I installed the > attached additional patch. This makes the code closer to what was in 2026d, > while still pacifying the compiler and avoiding a > cast.<0001-Revert-to-size_t-for-asctime_r-buffer-size.patch>
