printf field width argument handling
Wed Nov 25 08:52:00 GMT 2009
-----BEGIN PGP SIGNED MESSAGE-----
According to Eric Blake on 11/24/2009 9:55 PM:
>> A suggestion for the error reaction is to stop conversion, return
>> an error, and set errno to EINVAL. EINVAL seems the most appropriate,
>> as the format argument is invalid in the example case.
> What does glibc print/return for the given example?
Actually, after testing printf("%**s",1,"a","b")
on Solaris 10, it treats the pointer for "a" as an integer, and prints "b"
with the corresponding field width, without setting errno, and returning
the number of bytes printed. In other words, newlib behavior matches
on an older glibc box, it prints "%1*s", and returns 4 without setting errno.
Do we even have precedence of any other implementation that rejects the
string with a negative return value?
Don't work too hard, make some time for fun as well!
Eric Blake email@example.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the Newlib