Il 08/03/2012 17:25, Anthony Liguori ha scritto: >> >> Looks like a GCC bug where >> >> x = y = 0; >> >> is converted to >> >> x = (y = 0) != 0; > > Curious, why convert like this? What does this optimization do?
Nothing, it's just that if "y = 0" is an int (for some reason, I didn't check if it's implicit promotion or just that y is already an int), then it has to be converted back to a truth value before assigning to bool. If you do bool x; int y; x = y = 2; x is actually set to 1. Paolo