January 30, 2019 throw new RangeError() prevents algorithm.iteration from being @nogc | ||||
---|---|---|---|---|
| ||||
Is there any reason to use construct like `version (assert) if (empty) throw new RangeError();` intead of `onRangeError()` or just plain assert? Worse, this causes @nogc to differ between release and debug. See also: https://run.dlang.io/is/7h48fC Thanks |
January 30, 2019 Re: throw new RangeError() prevents algorithm.iteration from being @nogc | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ivan Butygin | On Wednesday, 30 January 2019 at 19:44:58 UTC, Ivan Butygin wrote:
> Is there any reason to use construct like `version (assert) if (empty) throw new RangeError();` intead of `onRangeError()` or just plain assert?
> Worse, this causes @nogc to differ between release and debug.
>
> See also: https://run.dlang.io/is/7h48fC
>
> Thanks
I would say, no. As if you want to assert, then, @nogc would ignore that, and if you release, the assert holds automatically.
If you want to throw, it would pass @nogc during debug, but resist during release compilation.
However, maybe I'm missing some relevant context...
|
Copyright © 1999-2021 by the D Language Foundation