A strange div bug on Linux x86_64, (both dmd & ldc2): long -5000 / size_t 2 = 9223372036854773308

FeepingCreature feepingcreature at gmail.com
Fri Aug 14 09:32:58 UTC 2020

On Friday, 14 August 2020 at 09:12:50 UTC, Walter Bright wrote:
> On 8/13/2020 10:47 PM, Simen Kjærås wrote:
>> This does not in any way address the problem here, namely that 
>> the intuitive way to do things causes issues in 
>> possibly-very-rare situations.
> On a more personal note, I came to C from Pascal. Pascal 
> required explicit casts everywhere one did mixed integer 
> arithmetic. I grew to dislike it, it was ugly and just plain 
> annoying.

To be fair, this issue specifically only happens with int/uint 
division. Addition, subtraction and even multiplication are all 

(*Why* is multiplication fine? I have no idea... but it works in 
spot testing.)

More information about the Digitalmars-d mailing list