Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Sep 2007 08:37:31 +0200 (CEST)
From:      Harti Brandt <hartmut.brandt@dlr.de>
To:        "Sean C. Farley" <scf@FreeBSD.org>
Cc:        Xin LI <delphij@FreeBSD.org>, freebsd-standards@FreeBSD.org
Subject:   Re: vfprintf() string precision type
Message-ID:  <20070917083135.V40808@knop-beagle.kn.op.dlr.de>
In-Reply-To: <alpine.BSF.0.9999.0709161922560.29967@thor.farley.org>
References:  <alpine.BSF.0.9999.0709161922560.29967@thor.farley.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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 that
SCF>precisions are always 32-bit.
SCF>
SCF>Would it be better to change the precision handling to expect size_t?
SCF>My reasoning is that strlen() and sizeof both return size_t.  It makes a
SCF>cast unnecessary for passing a value returned by either call as the
SCF>precision.  Unfortunately, I could find nothing from SUSv3 that
SCF>specified what type the precision could 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.

harti

PS: Not sure that I got your question right :-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070917083135.V40808>