On 31. 5. 2026 20:42, Daniel Sahlberg wrote:
Den sön 31 maj 2026 kl 19:38 skrev Branko Čibej <[email protected]>:On 31. 5. 2026 17:53, Daniel Sahlberg wrote:Den sön 31 maj 2026 kl 16:05 skrev Branko Čibej <[email protected]>: On Sun, 31 May 2026, 15:01 Daniel Sahlberg, <[email protected]> wrote: Hi, Even if Apple are incorrectly deprecating sprintf() and even if we know that our string will fit in the allocated buffer... Is there a significant drawback of just using snprintf()? Yes, it's explained right there in the comment: apr_psprintf() ignores the locale, so the decimal separator isn't localised. That's not quite what I meant. I saw the comment and I had no intention of using the apr_-functions. If I understand Apple's motivation correct, they want to promote snprintf()[3] instead of sprintf()[2].We can't use snprintf() because it's C99. Subversion is written in C90. That was the explanation I was looking for. Thanks.A completely different flame war is if it is time to move to C99. But I'm sure there are platforms out there where C90 is still the new hotness.
It's not about that, really. The question is whether using C99 would be any benefit in the long run. We surely won't rewrite any code, and the restrictions on the language – basically, not mixing declarations and code – aren't all that onerous. Besides, we still support modern platforms [1] that don't completely implement C99, so we'd be using a subset anyway.
Our usage of sprintf() is so specific, and can be made safe enough, that upgrading our base requirement for the sake of one library function doesn't make much sense to me. Yes, there's the restrict keyword that theoretically allows the compiler to make better optimisations, but realistically, that wouldn't affect us in any measurable way.
-- Brane [1] One "modern" platform...

