1 matches bool, 2 matches long
Andrej Mitrovic
andrej.mitrovich at gmail.com
Sat Apr 27 05:12:22 PDT 2013
On 4/27/13, kenji hara <k.hara.pg at gmail.com> wrote:
> // The expected behavior we can do at the most
> extern(C) int printf(const char*, ...);
> void foo(bool) { printf("bool\n"); }
> void foo(long) { printf("long\n"); }
> void main()
> {
> foo(0); // Error: function foo called with argument types: (int) matches
> both foo(bool) and foo(long)
> foo(1); // Error: function foo called with argument types: (int) matches
> both foo(bool) and foo(long)
> foo(2); // OK, matches to long
> }
That's even more stupid. We need *less* special cases, not more. We
already have true/false, they're keywords, any other integral literal
(*literal*, not expression) should not implicitly convert to bool.
More information about the Digitalmars-d
mailing list