[OT] The Usual Arithmetic Confusions
Paulo Pinto
pjmlp at progtools.org
Mon Jan 31 10:23:59 UTC 2022
On Monday, 31 January 2022 at 08:38:28 UTC, Ola Fosheim Grøstad
wrote:
> On Monday, 31 January 2022 at 07:33:00 UTC, Elronnd wrote:
>> I have no doubt it comes up _at all_. What I am asking is
>> that I do not believe it has an _appreciable_ effect on any
>> real software.
>
> Not if you work around it, but ask yourself: is it a good idea
> to design your language in such a way that the compiler is
> unable to remove this:
>
> ```
> if (x < x + 1) { … }
> ```
>
> Probably not.
One such language would be Go[0], it doesn't seem to impact
Docker, Kubernetes, gVisor, USB Armory, Android GPU debugger,
containerd, TinyGo, as some of the proper systems programming
where Go is used despite not being designed as such.
[0] - "A compiler may not optimize code under the assumption that
overflow does not occur. For instance, it may not assume that x <
x + 1 is always true.". Go Language Specification.
More information about the Digitalmars-d
mailing list