Avoid subtracting form .length

Manfred Nowak svv1999 at hotmail.com
Fri Nov 15 11:58:19 UTC 2024


On Thursday, 14 November 2024 at 13:24:47 UTC, Dom DiSc wrote:
> No, no. My problem is:  [...]
So it seems, that the intended problem was transposed into
some example, thereby oblittering that problem with some
coding errors.

> I checked that the source array has at least one element.
Yes, but only for the purpose of the development of the
code, because the used `assert' will probably not be
compiled into a release binary.

[...]
> - What else is proposed to implement the desired effect
> without warning?
Maybe using an `if`-statement, which is propper for release too,
instead of an `assert`-expression, which is propper for
develeopment only?
Please reconsider the docs at 11.19.10.9.1:
https://dlang.org/spec/expression.html#assert_expressions


More information about the Digitalmars-d-learn mailing list