News for hackers. Stuff that matters.
Re:C++26: Pack Indexing by mystified5016 on Friday January 24, 2025 @02:49PM (#42816361)
Can we have constexpr math functions like sqrt already?
Re:C++26: Pack Indexing by stefanos82 on Friday January 24, 2025 @02:55PM (#42816412)
Seems like since C++26, it does use constexpr https://en.cppreference.com/w/cpp/numeric/math/sqrt
Re:C++26: Pack Indexing by Maxatar on Friday January 24, 2025 @02:53PM (#42816397)
My understanding is that all of the functions found in the C compatibility headers that the C++ standard defines can not be made constexpr. sqrt is among them, as are a lot of the math functions.
Re:C++26: Pack Indexing by agosz on Friday January 24, 2025 @03:39PM (#42816703)
The compatibility can be solved with macros to toggle it on or off depending on how you're building. C++26 has constexpr sqrt.
Re:C++26: Pack Indexing by pjmlp on Friday January 24, 2025 @04:44PM (#42817210)
There is a paper suggesting to replace all macro based code, due to way modules work.

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p26...