Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Given appropriate likeliness annotations or profile-guided optimization, it's possible for the compiler to _invert_ the conditional and move the log statement to a "cold" section of code outside of the main flow, making it a never-taken branch.


Yes. I guess that's covered by "it's probably ok"... I'm going to play in godbolt now.


-O2 turns it into a "jump if nonzero" without any extra annotations: https://www.godbolt.org/z/j9dfrbosv




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: