1 matches bool, 2 matches long
deadalnix
deadalnix at gmail.com
Mon Apr 29 05:32:37 PDT 2013
On Sunday, 28 April 2013 at 22:40:33 UTC, Andrei Alexandrescu
wrote:
> On 4/28/13 5:41 PM, kenji hara wrote:
>> Yes, as Andrei mentioned, it is sometimes useful. But, at
>> least during
>> overload resolution, it must not occur.
>>
>> Kenji Hara
>
> Well the problem has other ramifications beyond bool. Consider:
>
> import std.stdio;
>
> int fun(short v1) { return 1; }
> int fun(long v1) { return 2; }
>
> void main(string[] args)
> {
> writeln(fun(10_000));
> writeln(fun(100_000));
> }
>
> This prints "1 2". So the behavior of bool in this case is
> consistent with the behavior of other integral types.
>
For the same reason, both should call the long overload.
More information about the Digitalmars-d
mailing list