I have been reading more on C++ 20, and recently noticed the [[likely]]
or [[unlikely]]
attributes. Which seems like an interesting concept, not found in previous versions of C++. According to the official CPP Reference:
Allow the compiler to optimize for the case where paths of execution including that statement are more or less likely than any alternative path of execution that does not include such a statement.
What does this really imply?
This blog post, argues against using them because it seems more like pre-mature form of optimization and a few other details. https://blog.aaronballman.com/2020/08/dont-use-the-likely-or-unlikely-attributes/