News for hackers. Stuff that matters.
Re:In the C++ bag of tricks: scoped locks by infogulch on Friday February 07, 2014 @12:31PM (#7197474)
Wait... if it's identical, how can it be safe against exceptions? `process2` isn't.
Re:In the C++ bag of tricks: scoped locks by saurik on Friday February 07, 2014 @03:17PM (#7198449)
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).
Re:In the C++ bag of tricks: scoped locks by twoodfin on Friday February 07, 2014 @12:34PM (#7197496)
gcc can statically determine that incrementing f.var will not throw.