On Wed, 21 Jun 2006, Derek Gaston wrote:
> Heh... nice!
> It makes sense though. bool has always just been an integer that's
> either 0 or 1 and integers automatically get upgraded to doubles
> (double test = 1;) so why not bools? ;-)
Bool may get implemented (at the compiler's discretion, I think) as an
integer, but just because it can be typecast is no reason to let it be
typecast automatically. Pointers and ints are often interchangeable
in memory, but doing so is odd enough that the user has to use an
explicit casting operator for it, right?
At the very least I'd appreciate a compiler warning about odd implicit
casts from bool. It's not as big a pitfall as implicit casts to bool
like "if (a = b)", but it's in the same category of "stuff the user
isn't likely to do on purpose and won't mind writing more explicitly".