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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake-1 on 9/14/2007 4:32 PM:
>> I think there is a bug in _VFPRINTF_R (vfprintf.c) in the string case.
> 
> Not a bug.
> 
>> I think if cp equals NULL, cp just  should be empty.
> 
> Why?  POSIX and C99 are both clear - if cp is NULL, your
> program is invoking undefined behavior.  Newlib is allowed
> to do whatever it wants, including reformat your hard
> drive.  However, for debuggability purposes, we have
> instead chosen to copy glibc, and print "(null)" to point
> out your non-compliant program a little more nicely.

On the other hand, you do point out an opportunity for optimizing for
space.  Wasting space for the storage of "(null)", as well as the code to
check for a null pointer, makes no sense if you did ./configure
- --enable-target-optspace, and maybe we should add an #ifdef to leave out
that code altogether.

- --
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

iD8DBQFG6xJl84KuGfSFAYARAuBoAKCQuCSIYv5ERn0g+0TYdDoThIJkhQCgiAII
ol5qET465EMTYgJFCojw0Xs=
=fnGe
-----END PGP SIGNATURE-----


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