Re: g_snprintf() implementation



Havoc Pennington wrote:
> 
> On Tue, 20 Apr 1999, Miguel de Icaza wrote:
> >
> > Please make sure this is well documented (ie, contribute to the glib
> > documentation) and point out specifically that this is different from
> > vsnprintf().  Seasoned developers might assume the standard snprintf
> > behaviour.
> >
> 
> Are the www.gtk.org/rdp docs in CVS?

No, the docs aren't in CVS, as we need to keep track of authors etc.


> Anyway, a "diff" for g_snprintf() and g_vsnprintf():
> 
> - The output is guaranteed to not exceed n characters,
> + The output is guaranteed to be '\0'-terminated and fit within
> + n characters, including the '\0'. Unlike GNU snprintf(), never
> + fails to '\0'-terminate.
> 
> - Returns: the length of the output string (some
> - implementations return -1 if the output was truncated).
> + Returns: the length of the output string not including '\0'.
> + Unlike GNU snprintf(), never returns -1. If n-1 is returned,
> + the string may have been truncated.

Thanks. I'll update them. (But I suppose these will only apply to the
next release of GLib).

Damon




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]