This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Bug in _VFPRINTF_R



> -----Original Message-----
> From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org] On
> Behalf Of Samuel Vinson
> Sent: Saturday, September 15, 2007 8:34 AM
> To: Eric Blake
> Cc: newlib@sourceware.org
> Subject: Re: Bug in _VFPRINTF_R
> 
> I'm sorry Eric, but I gave you a specific example :
>     printf("%.*s\n",len,(char *)NULL) /* len = 0 */
> 
> and not printf("%s", (char *)NULL)
> 


Actually, you didn't specify that len == 0.

Here's what you wrote:


> In my example, I think the result should be empty an not (null)
> 
> Samuel
> 
> Eric Blake a écrit :
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > According to Samuel Vinson on 9/15/2007 1:35 AM:
> >
> >> I never see that with different libc implementation, I used
> >> (linux/gcc/libc/glibc, windows/msvcrt, solaris/libc...)
> >>
> >
> > It may not match msvcrt or solaris libc, but it does match glibc - I'm
> not
> > sure how you tested it.
> >
> >
> >> Perhaps POSIX and C99 allow your choice, but this is not portable in
> >> different platforms.
> >>
> >
> > This is not portable, period.  Calling printf("%s", (char*)NULL) invokes
> > undefined behavior, and is a bug in your program, not in newlib.
> >
> > - --
> > Don't work too hard, make some time for fun as well!
> >
> > Eric Blake             ebb9@byu.net
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.5 (Cygwin)
> > Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
> > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> >
> > iD8DBQFG68gr84KuGfSFAYARAr2PAKCR56DlvOvhKZXMeDn+ecmYO7fXEQCeMEUV
> > kGk4bBxoFTk2hpRD3TiakLM=
> > =LIb4
> > -----END PGP SIGNATURE-----
> >
> >
> >


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]