[OT] The Usual Arithmetic Confusions
Nick Treleaven
nick at geany.org
Fri Feb 18 09:27:08 UTC 2022
On Friday, 18 February 2022 at 04:32:56 UTC, Walter Bright wrote:
> ptrdiff_t len = array.length;
The problem is remembering to do that, particularly in cases
where the unsigned value is an inferred function result, or for
an index involving $.
We need an error, not an implicit conversion. I expect you to say
that will force users to cast, which can introduce bugs if the
source type changes. The solution to that is to encourage using
e.g. std.conv.signed:
https://dlang.org/library/std/conv/signed.html
More information about the Digitalmars-d
mailing list