Comment Comment by mikepurvis C++20 is gaining the [[likely]] attribute for guiding the predictor in a portable way:http://eel.is/c++draft/dcl.attr.likelihoodPrior to this it was also possible, but required compiler-specific macros like GCC's __builtin_expect, which is used all over the kernel:https://github.com/torvalds/linux/search?q=__builtin_expect parent mikepurvis 4 years ago
http://eel.is/c++draft/dcl.attr.likelihood
Prior to this it was also possible, but required compiler-specific macros like GCC's __builtin_expect, which is used all over the kernel:
https://github.com/torvalds/linux/search?q=__builtin_expect