7.11.1 Boolean conditional logical operators
Visual Studio .NET 2003
When the operands of && or || are of type bool, or when the operands are of types that do not define an applicable operator & or operator |, but do define implicit conversions to bool, the operation is processed as follows:
- The operation
x&&yis evaluated asx ? y : false. In other words,xis first evaluated and converted to typebool. Then, ifxistrue,yis evaluated and converted to typebool, and this becomes the result of the operation. Otherwise, the result of the operation isfalse. - The operation
x||yis evaluated asx ? true : y. In other words,xis first evaluated and converted to typebool. Then, ifxistrue, the result of the operation istrue. Otherwise,yis evaluated and converted to typebool, and this becomes the result of the operation.