bin/53870: C++ undeclares standard math functions like isinf()
Michael van Elst
mlelstv at dev.de.cw.net
Sat Jun 28 03:40:14 PDT 2003
>Number: 53870
>Category: bin
>Synopsis: C++ undeclares standard math functions like isinf()
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Jun 28 03:40:11 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator: Michael van Elst
>Release: FreeBSD 5.1-CURRENT i386
>Organization:
dis-
>Environment:
System: FreeBSD dv2.dev.de.cw.net 5.1-CURRENT FreeBSD 5.1-CURRENT #0: Tue Jun 10 14:12:43 CEST 2003 root at dv2.dev.de.cw.net:/usr/src/sys/i386/compile/DV2 i386
>Description:
The following C++ program does not compile on FreeBSD5.*
#include <cmath>
void foo()
{
double d;
isinf(d);
}
The error message is:
c.cc: In function `void foo()':
c.cc:5: error: `isinf' undeclared (first use this function)
c.cc:5: error: (Each undeclared identifier is reported only once for each
function it appears in.)
This is caused by isinf() being a macro defined in math.h which is
then undef'd in the cmath header. The compiler _should_ then see the
underlying function implementation instead of the macro.
The same is true for some other functions declared in the near vicinity:
isinf()
isnan()
signbit()
and some others like fpclassify() and isfinite(). The latter however
do not exists as functions in libc.
The error appeared with the introduction of GCC3.3.
>How-To-Repeat:
See above
>Fix:
Add prototypes for isinf(), isnan(), signbit() functions to math.h.
Add function implementations for the other functions that are only
macros.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list