Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Nov 2001 09:30:02 -0800 (PST)
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: misc/31820: strdod(3): HUGE_VAL expected in <stdlib.h>, but is in <math.h>
Message-ID:  <200111081730.fA8HU2433530@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/31820; it has been noted by GNATS.

From: Bruce Evans <bde@zeta.org.au>
To: "Ralf S. Engelschall" <rse@engelschall.com>
Cc: <FreeBSD-gnats-submit@FreeBSD.ORG>
Subject: Re: misc/31820: strdod(3): HUGE_VAL expected in <stdlib.h>, but is
 in <math.h>
Date: Fri, 9 Nov 2001 04:18:53 +1100 (EST)

 On Wed, 7 Nov 2001, Ralf S. Engelschall wrote:
 
 > >Description:
 >
 > The manpage of strtod(3) correctly (according to SUSv2) says:
 >
 >    [...]
 >    SYNOPSIS
 >      #include <stdlib.h>
 >      double strtod(const char *nptr, char **endptr);
 >    [...]
 >    RETURN VALUES
 >    [...]
 >      If the correct value would cause overflow, plus or minus HUGE_VAL is
 >      returned [...]
 
 This seems to be just a bug in SUSv2.  The FreeBSD man page just doesn't
 mention _all_ the headers that may be needed for _all_ uses of the function.
 Doing so is very unusual for section [2-3] man pages, since few or none
 of the synopses mention <errno.h> but most of the functions can set errno.
 
 > >Fix:
 >
 > I don't know what the best fix for this is. Fact is that SUSv2 says
 > <stdlib.h> is enough. I don't know whether we nevertheless say "include
 > also <stdlib.h>" in our FreeBSD version of strtod(3) or whether we hack
 > our includes so math.h's HUGE_VAL is available through stdlib.h, too.
 > Someone else has to decide on a correct solution. It certainly is not
 > a major problem, but a little bit nasty because at least our strtod(3)
 > does not reflect the FreeBSD reality.
 
 The C standard doesn't cross-reference either <math.h> or <errno.h> in
 its specification of strtod().  IMO, man pages need such cross-references
 considerably less than paper standards, since they can be grepped.
 
 Bruce
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200111081730.fA8HU2433530>