This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

bug 4/ bool


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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]