1 matches bool, 2 matches long

MattCoder mattcoder at hotmail.com
Sat Apr 27 09:18:04 PDT 2013


One of the main problem that I saw here, is this behavior (DMD 
2.062):

import std.stdio;

void foo(bool b) { writeln("bool"); }
void foo(long l) { writeln("long"); }

void main()
{
int num = 0;

foo(num);
foo(0);
foo(2);
}

output:
long
bool
long

As num = 0, for me both: "foo(num)" and "foo(0)" should give the 
same output ("long"), regardless that num is integer implicit 
declaration or not.


More information about the Digitalmars-d mailing list