Should nanl(0) crash?

Andreas Schwab schwab@suse.de
Sun Jul 25 04:27:00 GMT 2004


Ulrich Drepper <drepper@redhat.com> writes:

> Petter Reinholdtsen wrote:
>> This code compile, run and print 0 on Tru64 Unix.  On Linux, it
>> crashes with a segfault.  Is it legal to call nanl(0)?  I tried
>> checking the C standard, but that didn't make me wiser. :(
>
> Why should this not crash?  It's no different from strlen(0) or atof(0).

It is.  The description of the nan functions does not require the argument
to be a string.  The last time I asked on comp.std.c I could not get a
definitive answer, but I believe the standard has a defect and nan(0) is
indeed supposed to be undefined.

http://groups.google.de/groups?hl=de&lr=&ie=UTF-8&th=fa4775574d2b6508&seekm=OuqRoZVr2jT%24Ewun%40romana.davros.org&frame=off

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



More information about the Libc-alpha mailing list