Patch to add snprintf/vsnprintf to libiberty

Paolo Carlini pcarlini@unitus.it
Wed Jun 12 12:14:00 GMT 2002


Kaveh R. Ghazi wrote:

>A.  What do we return when 'n' is zero?  0? -1?
>('n' is the supplied buffer length.)
>The standard above says an "unspecified value less than 1."
>I chose 0.
>
In my reading of the C99 standard (7.19.6.5), a negative value is 
returned if an encoding error occurred. Otherwise, is *always* returned 
what you called real_length (that is also when n == 0). Indeed, 
glibc2.2.5 behaves this way.

Paolo.




More information about the Gcc-patches mailing list