1 matches bool, 2 matches long

Walter Bright newshound2 at digitalmars.com
Thu Apr 25 22:02:53 PDT 2013


On 4/25/2013 7:54 PM, Kapps wrote:
> This is just silly.
> Changing enum defaultVal = 1 to defaultVal = 2 should never result in calling a
> different overload.

This does:

------------------------
import core.stdc.stdio;

enum x = 10000;
enum y = 40000;

int foo(short s) { return 1; }
int foo(long s) { return 2; }

void main()
{
     printf("%d\n", foo(x));
     printf("%d\n", foo(y));
}
-------------------------

A bool is an integer with the range 0..1


More information about the Digitalmars-d mailing list