On 4/26/2013 12:07 AM, Maxim Fomin wrote:
Regarding bool type as integer type is C atavism and should be abandoned.
There's a very loooong history of 0 being regarded as false and 1 as true - it goes well beyond C.
This leads to comic sitatuation presented in the thread when changing literal to lvalue or using different enums changes overloading matching.
Yet I showed an analogous example where different overloads were selected based on a different integer value.
There's no getting away from having to pay attention when declaring different overloads of a function. In the original example, the correct solution is to provide a foo(int). I'd be suspicious of any code that only had overloads on just bool and long - it doesn't make sense.