snprintf() confusion
Posted Feb 6, 2004 23:50 UTC (Fri) by
giraffedata (subscriber, #1954)
In reply to:
snprintf() confusion by ThePythonicCow
Parent article:
snprintf() confusion
This earlier return convention was actually "obvious" at the time -- no one on those slow, old machines would expect a C library routine to be wasting its CPU cycles calculating the length of some formatted output that it wasn't going to output
I doubt the wasted computation entered into the decision. The reason the old behavior was obvious at the time is that the function is emulating printf(), which like all Unix I/O routines, returns the number of characters transferred.
The modern sprintf return value, though useful, is actually quite unconventional.
(
Log in to post comments)