ostream& operator<< (ostream&, bool)

Gabriel Dos Reis Gabriel.Dos-Reis@dptmaths.ens-cachan.fr
Sun Apr 12 16:50:00 GMT 1998


Consider:

#include <iostream>

int main()
{
    cout << (1 == 1) << '\n' << (1 == 2) << '\n';
}

shouldn't the output be looks like 

true
false

instead of

1
0

?
IMHO, since bool type became a builtin type distinct form int, objects
of type bool should be displayed as they are (ie. true, false), and
not coerced to int before output. 

-- Gaby
"One reason that life is complex is that it has a 
real part and imaginary part." -- Andrew Koenig



More information about the Gcc mailing list