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

FeepingCreature feepingcreature at gmail.com
Thu Aug 13 13:40:34 UTC 2020

On Thursday, 13 August 2020 at 13:33:19 UTC, bachmeier wrote:
> That's why that behavior needs to be changed as well. It's 
> horrible to implicitly cast from int to double when doing so 
> results in obviously wrong behavior. Hopefully there won't be 
> any more talk about safe by default as long as the language has 
> features like this that are obviously broken and trivially 
> fixed.

It's not trivially fixed. :-(

I added a check for this case in DMD, just to see, and it breaks 
Phobos all over. Anything that interfaces to C with more 
complicated struct types does division with mixed signs. There'd 
need to be a lot of casts added as a result of changing this.

More information about the Digitalmars-d mailing list