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
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
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!
[+] [-] inciampati|6 years ago|reply
[+] [-] thechao|6 years ago|reply
[+] [-] thestoicattack|6 years ago|reply
But if we use operator new/delete instead of std::malloc the optimization doesn't take place: https://godbolt.org/z/vtxqD2
[+] [-] AbacusAvenger|6 years ago|reply
[+] [-] transitivebs|6 years ago|reply
[+] [-] shakna|6 years ago|reply
[+] [-] ismdeep|6 years ago|reply
[+] [-] ericwood|6 years ago|reply
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!
[+] [-] gshdg|6 years ago|reply