News for hackers. Stuff that matters.
Re:Sorting Algorithms in C by inciampati on Thursday January 30, 2020 @04:09AM (#22189998)
What's amazing to me is that sorting is still an open problem with active research producing new algorithms. It gets really tricky when you want to use parallel architectures to speed it up. Case in point: ips4o, https://github.com/SaschaWitt/ips4o
Re:Sorting Algorithms in C by thechao on Thursday January 30, 2020 @07:55AM (#22190981)
So is printing floating point numbers: https://cseweb.ucsd.edu/~lerner/papers/fp-printing-popl16.pd.... That paper was published in POPL -- one of the most distinguished conferences in all of CS.
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
Re:Sorting Algorithms in C by transitivebs on Thursday January 30, 2020 @01:50AM (#22189428)
The irony in these two posts being side-by-side is kind of awesome https://twitter.com/transitive_bs/status/1222772644212363267...
Re:Sorting Algorithms in C by shakna on Thursday January 30, 2020 @02:59AM (#22189706)
Hey, CNoEvil should still work with this as well. They're compatible. Insane to combine, but compatible.
Re:Sorting Algorithms in C by ismdeep on Thursday January 30, 2020 @02:51AM (#22189685)
aha~~lol~~
Re:Sorting Algorithms in C by ericwood on Thursday January 30, 2020 @11:14AM (#22192461)
Tangentially related: what resources would y'all recommend for learning modern-ish C?

I'm planning out a microcontroller project and reading through avr-libc I'm realizing my C skills have completely atrophied since college a decade ago. There seems to be a lot of outdated information out there, and honestly it's tough for me to judge the quality of what I'm reading. Any advice is greatly appreciated!

Re:Sorting Algorithms in C by gshdg on Thursday January 30, 2020 @10:57AM (#22192280)
Gee, this brings me back to second semester computer science class.