According to the standard, getting the value of an uninitialized variable is undefined behavior. Since the actual bool size can be more than one bit, the bool variable containing garbage can even contain bad values, such as 254. Welcome to hellish C ++!
And since (n> 0) evaluates to 1, 254 == 1 is false.
, , , positive , , , .
positive = something , , .
Konrad:
, , , == int-s, bool-s, bool-to-int, , bool 0 false 1 true ( && || int-s 0 true, bool-to-int ).
" ", , operator==(bool,bool), , , .
bool int ( ) , bad-bool , .
, UB, . , , .