[OT] The Usual Arithmetic Confusions

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Thu Feb 3 22:46:33 UTC 2022


On Thursday, 3 February 2022 at 22:12:10 UTC, Dukc wrote:
> On Thursday, 3 February 2022 at 21:36:19 UTC, Ola Fosheim 
> Grøstad wrote:
>> On Thursday, 3 February 2022 at 21:23:10 UTC, Dukc wrote:
>>> We cannot allow undefined behaviour in `@safe` code.
>>
>> Why not, make it implementation defined, with the requirement 
>> that memory safety is upheld by compiled code.
>
> That is a different solution. Implementation defined != 
> undefined.

"implementation defined" means that the vendor must document the 
semantics.

"undefined behaviour" means that the vendor isn't required to 
document the behaviour, but that does not mean that they are 
discouraged from doing so. This was introduced in the C language 
spec to account for situations where hardware has undefined 
behaviour. Competition between C++ compilers made them exploit 
this for the most hardcore optimization options.



More information about the Digitalmars-d mailing list