Hacker News new | ask | show | jobs
by karl_schlagenfu 2544 days ago
> A priority is to understand the language one is writing in.

That's all well and good but you can't expect a developer to know all the optimisations different compilers will do, especially when it relates to undefined behaviuor.

1 comments

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.
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.