vfprintf() string precision type

Sean C. Farley scf at FreeBSD.org
Sun Sep 16 18:39:04 PDT 2007


Xin LI noticed a warning in the code I wrote for setenv() where a
precision was provided with a string argument to warnx() (really
vfprintf()).  The warning appearing on amd64 and not i386 showed that
precisions are always 32-bit.

Would it be better to change the precision handling to expect size_t?
My reasoning is that strlen() and sizeof both return size_t.  It makes a
cast unnecessary for passing a value returned by either call as the
precision.  Unfortunately, I could find nothing from SUSv3 that
specified what type the precision could be.

Sean

P.S. I am not on this list; please keep the Cc.
-- 
scf at FreeBSD.org


More information about the freebsd-standards mailing list