Date: Mon, 17 Sep 2007 18:35:31 -0500 (CDT) From: "Sean C. Farley" <scf@FreeBSD.org> To: Harti Brandt <harti@FreeBSD.org> Cc: Xin LI <delphij@FreeBSD.org>, freebsd-standards@FreeBSD.org Subject: Re: vfprintf() string precision type Message-ID: <alpine.BSF.0.9999.0709171832160.56227@thor.farley.org> In-Reply-To: <20070917083135.V40808@knop-beagle.kn.op.dlr.de> References: <alpine.BSF.0.9999.0709161922560.29967@thor.farley.org> <20070917083135.V40808@knop-beagle.kn.op.dlr.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 17 Sep 2007, Harti Brandt wrote: > On Sun, 16 Sep 2007, Sean C. Farley wrote: > > SCF>Xin LI noticed a warning in the code I wrote for setenv() where a > SCF>precision was provided with a string argument to warnx() (really > SCF>vfprintf()). The warning appearing on amd64 and not i386 showed > SCF>that precisions are always 32-bit. > SCF> > SCF>Would it be better to change the precision handling to expect > SCF>size_t? My reasoning is that strlen() and sizeof both return > SCF>size_t. It makes a cast unnecessary for passing a value returned > SCF>by either call as the precision. Unfortunately, I could find > SCF>nothing from SUSv3 that specified what type the precision could > SCF>be. > > The argument to the %.*f is specified to be an int (7.19.6.1/5) so I > would assume that internal handling in printf() also uses int. > Paragraph 4 of the above section talks about the precision as 'an > optional decimal integer'. Well, one could interpret this to mean int, > but need not to. Yes, I see your point. It should be int, but it would be nice for the spec to say size_t. :) > PS: Not sure that I got your question right :-) You did. Thank you. Sean -- scf@FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.0.9999.0709171832160.56227>
