On 1. 6. 2026 22:30, Nathan Hartman wrote:
On Mon, Jun 1, 2026 at 3:37 PM Sean McBride<[email protected]> wrote:
On 31 May 2026, at 13:38, Branko Čibej wrote:

We can't use snprintf() because it's C99. Subversion is written in C90.

You could always do:

#ifdef APPLE || (STDC_VERSION >= 199901L)
snprintf(...)
#else
sprintf(...)
#endif

I would not be surprised if Apple removes sprintf() one day, this way you'd be 
ready.

You could even remove the APPLE from that condition and just check for
STDC_VERSION.

We are implemented in C90 but nothing stops someone from building with
a later standard.

Or we could create a configure-time check – in two build systems, no less – if snprintf() is available, and write a wrapper that selects the right function. Or go way overboard in some other way, for example, by extracting the number separator from LC_NUMERIC from locale info and completely differently on Windows. All for that one usage in our core code.

I prefer to just silence the brain-dead warning and leave code that's been running just fine for the last 8 years alone. We do the same for MSVC with _CRT_SECURE_NO_DEPRECATE & Co. and at least Microsoft gives us just the one knob to turn those warnings off.

-- Brane

Reply via email to