News for hackers. Stuff that matters.
Re:Static search trees: 40x faster than binary search by ryao on Tuesday December 31, 2024 @08:38PM (#42563277)
The code snippets should be accepted by a C compiler and therefore are valid C code.
Re:Static search trees: 40x faster than binary search by npalli on Tuesday December 31, 2024 @08:43PM (#42563302)
If you want to be pedantic, there is a constexpr in the snippets, wont be accepted by the C compiler. More broadly though it is a C++ tutorial. I insisted on it because the author of algorithmica actually explains he chose C++ and perhaps sometime later C/Rust or something might be better. Should respect his POV.
Re:Static search trees: 40x faster than binary search by ryao on Tuesday December 31, 2024 @08:58PM (#42563380)
I had not seen the use of constexpr. You are correct that those are in C++.
Re:Static search trees: 40x faster than binary search by lubutu on Wednesday January 01, 2025 @02:40AM (#42564567)
C23 has constexpr, albeit only for objects, not functions. The code also uses namespaces, as in `std::aligned_alloc(P, T)`.
Re:Static search trees: 40x faster than binary search by ryao on Wednesday January 01, 2025 @05:35AM (#42565197)
You have to be 1/3 down the page to see any of this in the code examples. By that point, you would already have seen a number of examples that are valid C code and it is reasonable to expect the rest to be. At least, that was my experience.