X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com X-Authenticated: #27081556 X-Provags-ID: V01U2FsdGVkX19l7XhfDJ9l9coiZXtSBizOjFkh+y9iPgRgmYoLag t9SQucCAcZlJ+m From: Juan Manuel Guerrero To: djgpp-workers AT delorie DOT com Subject: Re: Implementation of [v]as[n]printf() family of functions. Date: Mon, 7 Apr 2008 00:51:44 +0200 User-Agent: KMail/1.9.5 References: <200804062347 DOT 42980 DOT juan DOT guerrero AT gmx DOT de> <200804062219 DOT m36MJ8dK023662 AT envy DOT delorie DOT com> In-Reply-To: <200804062219.m36MJ8dK023662@envy.delorie.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200804070051.45558.juan.guerrero@gmx.de> X-Y-GMX-Trusted: 0 Reply-To: djgpp-workers AT delorie DOT com Am Montag, 7. April 2008 00:19 schrieben Sie: > > > +@example > > +char *strbuf; /* Pointer to the allocated buffer by asnprintf. */ > > +int strlng; > > +long double pi = 3.1415926535897932384626433832795L; > > + > > +strlng = asnprintf(&strbuf, 100, "Pi = %.15Lf\n", pi); > > I think that comment needs to read "Pointer to an allocated buffer > used by asnprintf". The current wording is a little confusing. OK. > Also, it would be a good idea to explicitly show the strbuf=malloc() > command as well, else the example shows us using an uninitialized > pointer. I do not understand this. The pointer is uninitialized. strbuf=malloc() happens in asnprintf(). The user shall never pass an initialized pointer or this memory segment will be lost. If the [v]as[n]printf() functions are able to allocate enough memory then *strbuf will point to memory large enough to keep the string with the terminating '\0' or it will be set to NULL to indicate function failure. > Likewise for the other examples. > > Otherwise, it's OK. OK