01777777777777777777777 [std.conv.octal]

user1234 user1234 at 12.de
Thu Apr 7 20:18:14 UTC 2022


On Thursday, 7 April 2022 at 19:59:24 UTC, Steven Schveighoffer 
wrote:
> Another problem I just realized:
>
> ```d
>     auto x1 = octal!17777777777;
>     auto x2 = octal!"17777777777";
>     pragma(msg, typeof(x1)); // long
>     pragma(msg, typeof(x2)); // int
> ```
>
> Why? because `octal(T)` takes the type of `T`
>
> And there's no way to fix it. Because you'd want `octal!1L` to 
> be long, so you can't just look at the value.

I dont see any real problem with x1 type because you can request 
to have it as `int` without cast

```
int x1 = octal!17777777777;
```




More information about the Digitalmars-d mailing list