1 matches bool, 2 matches long
kenji hara
k.hara.pg at gmail.com
Sat Apr 27 08:11:59 PDT 2013
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 <minas_mina1990 at hotmail.co.uk>
> 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?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130428/553ab959/attachment-0001.html>
More information about the Digitalmars-d
mailing list