Bug in ^^

bachmeier no at spam.net
Tue Sep 17 16:16:44 UTC 2019


On Tuesday, 17 September 2019 at 13:48:02 UTC, Brett wrote:

> it's shorthand for writing out the long version, it shouldn't 
> silently wrap, If I write out the long version it craps out so 
> why not the computation itself?

I think you should be using 
https://dlang.org/phobos/std_experimental_checkedint.html rather 
than getting into the weeds of the best language design choices 
long ago. My thought is that it's relatively easy to work with 
long if that's what I want:

10L^^16
long(10)^^16

I have to be explicit, but it's not Java levels of verbosity. 
Using long doesn't solve overflow problems. A different default 
would be better in your example, but it's not clear to me why 
that would always be better - the proper default would be 
checkedint.


More information about the Digitalmars-d mailing list