[OT] The Usual Arithmetic Confusions

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Thu Feb 3 17:05:01 UTC 2022


On Thursday, 3 February 2022 at 16:41:45 UTC, Dukc wrote:
> What's your point? Even when a compiler provides more 
> guarantees than the language spec, you should still avoid 
> undefined behaviour if you can. Otherwise you're deliberately 
> making your program non-spec compliant and therefore likely to 
> malfunction with other compilers.

If you don't get my point, what can I do about it?

Modular arithmetics doesn't help at all, it makes it worse. It is 
better to have a conditional correctly removed than wrongly get 
it inverted, the latter is disastrous for correctness.

So no, undefined behaviour is not worse than defined behaviour 
when the defined behaviour is the kind of behaviour nobody wants!



More information about the Digitalmars-d mailing list