Implicit integer conversions Before Preconditions

jmh530 john.michael.hall at gmail.com
Tue May 24 21:11:13 UTC 2022


On Tuesday, 24 May 2022 at 21:05:00 UTC, Steven Schveighoffer 
wrote:
> [snip]
>
> ```d
> // e.g.
> foo(int x)
> in (x >= 0)
> {
>    return foo(uint(x));
> }
> ```
>
> And remove those useless `in` conditions on the unsigned 
> versions, an unsigned variable is always >= 0.
>
> -Steve

Thanks. That makes perfect sense. I just got thrown by the 
preconditions not running first.


More information about the Digitalmars-d-learn mailing list