tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: cmath vs. math.h vs isfinite



Thomas Klausner <wiz%netbsd.org@localhost> 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"?


Home | Main Index | Thread Index | Old Index