News for hackers. Stuff that matters.
Re:Sorting Algorithms in C by thestoicattack on Thursday January 30, 2020 @09:44AM (#22191576)
So I was all set to bash include/data-swap.c for allocating on the heap every time you need to swap memory. Turns out that gcc can optimize out that temporary, and it ends up the same as std::swap.

But if we use operator new/delete instead of std::malloc the optimization doesn't take place: https://godbolt.org/z/vtxqD2

Re:Sorting Algorithms in C by AbacusAvenger on Thursday January 30, 2020 @05:47PM (#22196746)
Neat find. Clang seems to be consistent about it in all 3 cases though: https://godbolt.org/z/iH7ydo