4 ms·
> 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
by karl_schlagenfu 7y 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.
- charleslmunger 7y agoI 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.
- zokier 7y agoThe 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.
- zaarn 7y agoAnd next thing you know, 1000 people with compilers that subtle do not behave to spec knock on your door.