On Thu, Mar 13, 2014 at 1:28 PM, Thomas Hellstrom <thellstrom at vmware.com> wrote: > But a compiler can't (or shouldn't) make that assumption. Just as an > (adapted) example, imagine that > each test had a 20% probability of returning an error. The probability > of the function returning an error would > then be 68%..
Otoh if you'd put the unlikely just onto the if (ret) then the compiler could infer that by necessity all branches leading towards this one are also unlikely. Dunno whether compilers are this clever though, and I also don't really care if we throw a few too many likely/unlikely annotations over the place. Just figured I'll throw this in. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch