[libcxx-commits] [PATCH] D137502: [libc++][math.h] move #undefs to the top and guard explicitly against MSVCRT instead
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Nov 22 07:04:56 PST 2022
ldionne added a comment.
In D137502#3941596 <https://reviews.llvm.org/D137502#3941596>, @EricWF wrote:
> This changes behavior.
>
> Currently libc++ only provides its own definitions of a math function if there's a macro which is normally used to define it.
> Now libc++ always provides those overloads. That could cause redefinition errors.
>
> I know there's been a lot of churn in this header recently , so maybe the diff I'm reading is out of date, but please verify that's the case.
Let's talk about `signbit` just to simplify things, but this applies to all of them AFAICT. My understanding is that C implementations are required to make this a macro: https://en.cppreference.com/w/c/numeric/math/signbit
If that were not the case, previously we would not have been defining `signbit`, so we would have been non-confirming because C's `signbit` only works with floating point, whereas C++'s `signbit` is supposed to work with integral types as well: https://en.cppreference.com/w/cpp/numeric/math/signbit
In other words, I'm not sure there are many C implementations that define them as functions, but I may be wrong. I know GCC and the macOS SDK both define them as macros.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137502/new/
https://reviews.llvm.org/D137502
More information about the libcxx-commits
mailing list