Re: snprintf heads-up

From: Date: Fri, 08 Sep 2000 14:15:22 +0000
Subject: Re: snprintf heads-up
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-32669@lists.php.net to get a copy of this message
Zeev Suraski <zeev@zend.com> wrote: > Question is, what do we do about it. In my opinion, the most 'sensible > behavior' would be snprintf() returning the actual amount of characters > written. This behaviour is not particularly useful, because it means that if your buffer turns out to be too small, and you want to extend it, you have no way of knowing by how much you need to increase it. > As far as I can tell from glancing through snprintf.c, this version of > snprintf() would return the number of characters that were effectively > written under all circumstances (I could be wrong, we need to test it). Obviously your own snprintf can do what it likes, but if you give it a familiar name but unusual behaviour then this may cause confusion. Cheers Jon

« previous php.dev (#32669) next »