James Carlson wrote:

> Regardless of whether glibc implements POSIX, I don't think that
> ignoring bad pointers is good programming practice.  Perhaps it's just
> my opinion alone, but I think failing to consider whether a pointer
> ought to be NULL and doing something about it reflects a lack of due
> care.

Indeed... but we're just being particularly picky in about printf... in
the libc malloc implementation, we were far more accommodating
of broken programs - the existing implementation allows the same
pointer to be freed multiple times (so long as there was no intervening
call to {re,m,c}alloc), and realloc works if given a pointer that was 
already
freed.  These are much more pernicious and dangerous than allowing a
NULL pointer to be passed to "%s" format specifiers.  Also, we print
NaN when an illegal floating point number is passed to printf rather tjhan
just raising a FP exception.

We can either choose to be compatible w/ virtually everyone else, or
we can continue to be particular about  printf's string arguments.
Personally, I'd vote for compatibility.

- Bart


-- 
Bart Smaalders                  Solaris Kernel Performance
barts at cyber.eng.sun.com              http://blogs.sun.com/barts
"You will contribute more with mercurial than with thunderbird."

Reply via email to