Please consider the following piece of code:
void error_handling();
bool method_impl();
bool method()
{
const bool res = method_impl();
if (res == f
The underlying hardware already performs this optimizations. It will "fail" to predict it the first times, but after it will hit the correct option en.wikipedia.org/wiki/Branch_predictor.
You can try applying the GCC extension and check if it is faster with it or not, but I think you will barely see any difference with it and without it. The branch prediction is applied always, it is not something you enable