Time to move std.experimental.checkedint to std.checkedint ?

Walter Bright newshound2 at digitalmars.com
Tue Mar 30 03:31:05 UTC 2021


On 3/29/2021 6:29 PM, tsbockman wrote:
> On Tuesday, 30 March 2021 at 00:33:13 UTC, Walter Bright wrote:
>> Having D generate overflow checks on all adds and multiples will immediately 
>> make D uncompetitive with C, C++, Rust, Zig, Nim, etc.
> 
> As someone else shared earlier in this thread, Zig already handles this in 
> pretty much exactly the way I argue for:
>     https://ziglang.org/documentation/master/#Integer-Overflow

I amend my statement to "immediately make D as uncompetitive as Zig is"

Note that Zig has a very different idea of integers than D does. It has 
arbitrary bit width integers, up to 65535. This seems odd, as what are you going 
to do with a 6 bit integer? There aren't machine instructions to support it. 
It'd be better off with a ranged integer, say:

    i : int 0..64


More information about the Digitalmars-d mailing list