ushort calls byte overload

Oleg B via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 30 14:54:14 PDT 2017


On Tuesday, 30 May 2017 at 21:42:03 UTC, Daniel Kozak wrote:
> Compiler do many assumptions (it is sometimes useful).

but if compiler find one-to-one correspondence it don't make 
assumptions, like here?

> import std.stdio;
>
> void f(ushort u)
> {
>     writeln("ushort");
> }
>
> void f(ubyte u)
> {
>     writeln("ubyte");
> }
>
> void main()
> {
>     ushort y = 0;
>     immutable ushort x = 0;
>
>     f(y);
>     f(x);
> }
>
> RESULT IS:
> ushort
> ushort

or it can?


More information about the Digitalmars-d-learn mailing list