Keith M Wesolowski <[EMAIL PROTECTED]> wrote:

> On Sat, Jul 15, 2006 at 08:42:29PM -0700, Andy Spitzer wrote:
>
> > I think that passing NULL to formatting functions for %s should not
> > crash, (ala glibc) as NULL is a perfectly legal value for a string.
> > It is the same as passing the results of 1.0 /0.0 to a %f.  The
> > formating functions convert that to "Inf", why shouldn't they
> > convert NULL %s as "(NULL)" as well?
>
> Your analogy is flawed.  NaN is a well-defined, valid floating-point
> non-quantity.  If you were to take the address of such a value, the
> resulting pointer would likewise be valid, and dereferencing it would
> yield the expected result.  Instead, the analog to NaN is the empty
> string (""), which contains nothing yet has a valid, well-defined
> address which can be dereferenced.  NULL isn't a pointer to anything,
> and is therefore not an acceptable argument to a function which
> requires a pointer to *something*.  To complete your analogy in the
> converse, passing NULL to a function which expects a float * is no
> more acceptable than passing NULL to a function which expects a char
> *, even if the former would happily accept a pointer to NaN.

This is not a valid analogy.

While you may do string operation on "", NaN is "not a number", so you cannot
use it (which looks similar to what "referencing" is for strings).

Jörg

-- 
 EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin
       [EMAIL PROTECTED]                (uni)  
       [EMAIL PROTECTED]     (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to