Hacker News new | ask | show | jobs
by charleslmunger 2544 days ago
I think the point of the OP is that you shouldn't think about the optimizations a compiler might do, but what the language spec guarantees. If the language spec guarantees that your code behaves the way you want, no correct compiler will break it.
2 comments

The problem arises when the language simply does not provide any guarantees on the sorts side-effects you are interested in, so you can not simply rely on specified behavior.
And next thing you know, 1000 people with compilers that subtle do not behave to spec knock on your door.