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

Mathias LANG geod24 at gmail.com
Thu Aug 20 02:27:06 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.

IMO that's the most important point. If we were to make it a 
warning, it would trigger *everywhere* and very often on valid 
code. The signal to noise ratio would be terrible, as it 
currently is for C++ code.

I really think there is room for improvement, but anything that 
would trigger false positive I would strongly oppose. In D I 
never feels like I have to please the compiler, because errors 
are almost always sane. In C++, you always have to throw a few 
compiler switches (`-Wall -Wextra`) and then write your code so 
that the compiler is happy. No thanks.

If anyone want an example of bad warnings in D: 

More information about the Digitalmars-d mailing list