This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Should nanl(0) crash?
- From: Andreas Schwab <schwab at suse dot de>
- To: Ulrich Drepper <drepper at redhat dot com>
- Cc: Petter Reinholdtsen <pere at hungry dot com>, libc-alpha at gnu dot org
- Date: Sun, 25 Jul 2004 01:10:48 +0200
- Subject: Re: Should nanl(0) crash?
- References: <E1BoTen-0007CE-SF@saruman.uio.no> <4102D962.3050806@redhat.com>
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."