Michael Jørgensen wrote:

Hi there,

Is there any difference between

bool success = SomeFunctionReturningFalse();

success &= SomeOtherFunction();

and

bool success = SomeFunctionReturningFalse();

success = success && SomeOtherFunction().

????

In the latter case I expect that SomeOtherFunction() will not be called,

because of short circuit evaluation, but what about the first case?

In the first case SomeOtherFunction() will allways be called. There are

other differences. 'Bitwise and' and 'logic and' are different

operators. If you want a logic and, you should use it. For example,

given the following declaration and assuming a 2's complement

representation.

int a = 2, b = 4;

a && b == 1 //both values represent true

a & b == 0 //0b00...0010 & 0b00...0100 = 0b00...0000