OK. I misunderstood.
C does not allow function overloading, so same problem is not there.
In C++,
// test.cpp
#include <stdio.h>
void foo(bool) { printf("bool\n"); }
void foo(long) { printf("long\n"); }
int main(int argc, char **argv)
{
foo(false); // matches bool version
foo(true); // matches bool version
foo(0); // ambiguous
foo(1); // ambiguous
foo(2); // ambiguous
return 0;
}
The behavior is same with GCC 4.7.2 (using msys) and dmc.
Walter, now I changed my opinion. It seems not correct that being regarded
bool type as one of the integer.
How about?
Kenji Hara
2013/4/27 Minas Mina <[email protected]>
> On Saturday, 27 April 2013 at 11:41:30 UTC, kenji hara wrote:
>
>> First, I can guess that why Walter disagree *fixing* this problem.
>>
>> http://dlang.org/overview.html
>>
>>> Major Design Goals of D
>>> 9. Where D code looks the same as C code, have it either behave the same
>>>
>> or issue an error.
>>
>>
> C doesn't have a bool type, so how can D behave the same?
>