A strange div bug on Linux x86_64, (both dmd & ldc2): long -5000 / size_t 2 = 9223372036854773308
Adam D. Ruppe
destructionator at gmail.com
Thu Aug 13 23:38:03 UTC 2020
On Thursday, 13 August 2020 at 23:28:43 UTC, H. S. Teoh wrote:
> And before somebody tells me this is too verbose: we already
> have to do this for short ints, no thanks to the recent change
> that arithmetic involving anything smaller than int will
> implicitly promote to int first:
That's not actually a recent change; it has always been like
that, inherited from C.
D's difference is that C will implicitly convert back to the
small type and D won't without an explicit cast. Drives me nuts
and very rarely actually catches real mistakes.
The most recent change here is even like `-a` will trigger the
error. It always did the promotion but it used to cast right back
and now will error instead. Ugh.
More information about the Digitalmars-d