bug 4/ bool

Breymann Breymann@t-online.de
Mon Dec 22 07:53:00 GMT 1997


gcs-1.0 (linux)

bool does not behave as expected (see testcase below).

best wishes!

      Uli


***** test case ****
#include<iostream.h>

int main()
{
   bool logicalValue;
   if(logicalValue) 
   {
       cout << "true\n";
       logicalValue = !logicalValue;  // negation
       if(logicalValue)
          cout << "Error! logicalValue must be false here!\n";
   }
   else cout << "logigalValue by accident initialized with false\n";
}

The program shows the error message, i.e. negation does not work.

Reason: wrong initialization of bool objects, should be undefined, but
either true or false





More information about the Gcc-bugs mailing list