[Python-Dev] Re: PEP 285: Adding a bool type

Andrew Koenig ark@research.att.com
03 Apr 2002 23:08:12 -0500


David> FWIW, that's the way it is in C++, and almost all of the same
David> conclusions fall out of it. Also, as distasteful as it may seem
David> intellectually, I have yet to hear any complaints about this
David> situation in practice... so it seems to work out OK.

It seems only fair that I should mention a complaint:  The fact that
bool is an integral type makes it necessary to have operator const void*
rather than operator bool as members of istream and ostream for
end-of-file testing.  Otherwise, writing ``cin << x'' instead of
``cin >> x'' by mistake would result in converting cin to bool
and thence to int, shifting the result right by x bits, and throwing
it away.

-- 
Andrew Koenig, ark@research.att.com, http://www.research.att.com/info/ark