On Friday, 26 April 2013 at 05:02:50 UTC, Walter Bright wrote:
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

This "feature" never has been useful to me. It has caused bug.
Additionally, the behavior is inconsistent :

int i = 1;
foo(i); // Don't call the bool version.

Reply via email to