Re: cmath vs. math.h vs isfinite

Greg Troxel <[email protected]>
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
Thomas Klausner <[email protected]> writes:

> #include <cmath>
> #include <math.h>

I am guessing there is a bug, but I have been running into a
perhaps-related issue.  This note is from memory so may be slightly off.

In C++, if you include <cmath>, and then want to use e.g. abs, the
standards say that you should write std::abs().  But they allow
compilers to make std::abs() available as just abs(), and some code does
that.  I fairly frequently find instances of this, and submit upstream
bug reports.  I have found that almost always, maybe always, upstreams
fix this (or perhaps, do not say I'm wrong, don't remember if any
nonresponsive).

I think what you are seeing is different, which is that things declared
in C for math.h are omitted.


A further standards question: Why is it ok to include math.h in C++
without extern "C"?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.