"Peteris Krumins" <pk****************@inbox.lv> wrote in message
news:Xn*******************************@130.133.1.4 ...
Hello,
Can I assume that writing the following if/etc. statement,
the second part of it will not be evaluated at all if
ptr_to_char is/points_to NULL :
if (ptr_to_char == NULL || strlen(ptr_to_char) == 0)
if (ptr_to_char == NULL || *ptr_to_char == 0)
But yes, the standard says...
The || operator shall yield 1 if either of its operands compare unequal
to 0; otherwise, it yields 0. The result has type int.
Unlike the bitwise | operator, the || operator guarantees left-to-right
evaluation; there is a sequence point after the evaluation of the first
operand. If the first operand compares unequal to 0, the second operand
is not evaluated.
--
Peter