What does a cast really do?

Lance Bachmeier no at spam.net
Fri Feb 21 16:23:00 UTC 2025


On Friday, 21 February 2025 at 15:48:12 UTC, Steven Schveighoffer 
wrote:

> But.... testing this, it doesn't make sense:
>
> ```d
> uint x = long(-1); // OK
> uint y = -1L; // Error: cannot implicitly convert expression 
> `-1L` of type `long` to `uint`
> ```
>
> Surely something here is worthy of a bug report?
>
> -Steve

This compiles too:

```
uint y = double(-1);
writeln(y); // 4294967295
```


More information about the Digitalmars-d-learn mailing list