This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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: Should nanl(0) crash?


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


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