Comment by jeffbee
7 hours ago
That is both really useful and a great example of why they should have stopped writing code in C decades ago. So many kernel bugs have arisen from people adding early returns without thinking about the cleanup functions, a problem that many other language platforms handle automatically on scope exit.
Must we do this on every thread about the Linux kernel?
The beatings will continue until morale improves
yeah but Linux is love, linux is life. if you really want to get the beatings going:
Rust > C and GNU/Linux should be Rust.
1 reply →
[flagged]
This ought to help with that. https://thephd.dev/c2y-the-defer-technical-specification-its...
> stopped writing code in C decades ago.
And what were they supposed to use in 2006? Free Pascal? Ada?
Someone suggested C++ and you should see the response from Linus
https://harmful.cat-v.org/software/c++/linus
Of course I specifically avoided invoking that language's name within the context of kernel programming in fear of summoning a Linus.
And he's so right. I didn't think like that back then, but new/delete (which have to be overloaded for kernel) behind allocators behind containers, vtables, =0, uninitialized members, unhandled ctor errors, template magic, "sometimes rvo", compiler hints, "sometimes reinterpret cast", 3rd party libraries, it would have been a disaster 20 years ago. Now he's being nice to Rust partially to spite that lang I love some more.