r/programming • • Aug 22 '26

The unlikely Linux macro

https://rushed-reflections.bearblog.dev/an-unlikely-experiment/

Wrote a bit about the `unlikely` and `likely` macros in the Linux codebase. Great little exploration into tiny optimizations that everyone should know more about 😄

188 Upvotes

61 comments sorted by

View all comments

Show parent comment

8

u/ShinyHappyREM Aug 23 '26

0

u/_Noreturn Aug 23 '26

I could point out the many systems in C++ and huge things like gcc and clang and unreal engine.

Why would a kernel be different? they got rust in there why not C++? and so so much of linux codebase would he heavily simplified by simply using RAII it would quite easily get rid of 90% of linux gotos. Doesn't everything in kernel get code reviewed then they should enforce their style guide.