and operator

   
and operator Logical and operator

  logical-and-expr  :=  logical-and-expr  &&  inclusive-or-expr   logical-and-expr  and  inclusive-or-expr  

The logical and operator converts its operands to type bool and returns a bool result. This built-in operator is a short-circuit operator, so if the left operand is false , the expression yields false without evaluating the right operand. Note that an overloaded operator and cannot be short-circuited and must evaluate both operands. The keyword and is interchangeable with the && token.

Example

 int* p; if (p != NULL  and  *p != 0)   do_stuff(*p); 

See Also

bitand , bool , expression , not , or , Chapter 3, <ciso646>

   


C++ in a Nutshell
C++ in a Nutshell
ISBN: 059600298X
EAN: 2147483647
Year: 2005
Pages: 270
Authors: Ray Lischner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net