printf field width argument handling

Corinna Vinschen vinschen@redhat.com
Wed Nov 25 13:09:00 GMT 2009


On Nov 24 22:13, Eric Blake wrote:
> 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
> Solaris behavior.

The code is BSD-based in both cases.

> on an older glibc box, it prints "%1*s", and returns 4 without setting errno.

Same on a newer glibc-based system (Fedora 11).

I don't think we have to return with errno set, either.  I'm not even
sure if we should change the behaviour at all, given that practically
all BSD-based systems behave that way.


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat



More information about the Newlib mailing list