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

mw mingwu at gmail.com
Thu Aug 13 19:40:28 UTC 2020

On Thursday, 13 August 2020 at 19:24:11 UTC, Tove wrote:
> One should always use unsigned whenever possible as it 
> generates better code, many believe factor 2 is simply a shift, 
> but not so on signed.

I'm fine with that. In many area of the language design, we need 
to make a choice between:  correctness v.s. raw performance.

But at least we also need *explicit* visible warning message 
after we've made that choice:

-- especially warnings about *correctness* when the choice was 
made favoring performance
-- if the choice was made favoring correctness, user will notice 
the performance when the program runs.

Personally, I will favor correctness over performance in my 
program design decisions: make it correct first, and faster 
later; you never know before-hand where your program's bottleneck 

I'm sure you know the famous quote:

"Premature optimization is the root of all evil!"

More information about the Digitalmars-d mailing list