I'm glad throw is now an expression
kdevel
kdevel at vogtner.de
Thu May 19 14:55:38 UTC 2022
On Thursday, 19 May 2022 at 09:11:45 UTC, Vladimir Panteleev
wrote:
[...]
> How so? This makes sense to me:
>
> ```d
> int divide(int dividend, int divisor)
> {
> return divisor == 0
> ? assert(false, "You shall not divide by zero")
> : dividend / divisor;
> }
> ```
The condition should read
```
divisor == 0 || dividend == int.min && divisor == -1
```
but that is not the reason why I am posting:
Issue 23126 - wrong result of integer division in presence of
assert within conditional operator expression
https://issues.dlang.org/show_bug.cgi?id=23126
More information about the Digitalmars-d
mailing list