[libcxx-commits] [libcxx] [libcxx] Undefine all supported C math functions (PR #94533)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 11 01:18:53 PDT 2024


philnik777 wrote:

> I have reverted to the earlier implementation which shouldn't have this issue and include a comment with explanation for why this is needed.
> 
> > Interesting. But wouldn't that mean that we'd technically also have to `#undef memcpy` and every other C function that exists? That seems a bit excessive to me.
> 
> I believe we only need to do this for functions where we provide our own definition in libc++.

In C++ users are free to write
```c++
namespace my_ns {
  void memcpy() {}
}
```
though, which would break if `memcpy` was something like `#define memcpy(dest, src, size) __memcpy(dest, src, size)`. 


https://github.com/llvm/llvm-project/pull/94533


More information about the libcxx-commits mailing list