[OT] The Usual Arithmetic Confusions

Paulo Pinto pjmlp at progtools.org
Mon Jan 31 17:22:42 UTC 2022


On Monday, 31 January 2022 at 16:05:23 UTC, Ola Fosheim Grøstad 
wrote:
> On Monday, 31 January 2022 at 10:23:59 UTC, Paulo Pinto wrote:
>> 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.
>
> You can still remove it, you just need to assert the condition 
> before you get any side-effects (I/O), but you can delay that 
> test so it occurs outside the loop.
>
> There is a difference between a language spec and consequences 
> for what compilers can do.

Compilers can do whatever they feel like, except when one doesn't 
follow "A compiler may not optimize code under the assumption 
that overflow does not occur" is no longer compliant with the 
language specification, no matter what.

Similarly a Scheme compiler that doesn't do tail call recursion 
isn't a Scheme proper, as the standard has specific details how 
tail recursion is required to exist.

Naturally on the cowboy land of what ISO says and the holes it 
leaves for UB and implementation defined on C and C++ compilers 
is another matter.


More information about the Digitalmars-d mailing list