Hacker News new | ask | show | jobs
by infogulch 4510 days ago
Wait... if it's identical, how can it be safe against exceptions? `process2` isn't.
2 comments

In addition to twoodfin's answer, I will point out that even if the code could throw, the code for the function would still be identical for when a throw did not occur (as in, we would see identical output with the addition of some code that would seemingly never be used or executed), on "good architectures", due to zero-cost exceptions (which only incur overhead during unwind; if no exception is thrown the code executed is exactly identical to if exceptions were not possible).
gcc can statically determine that incrementing f.var will not throw.