|
6810 | 6810 | \end{bnf}
|
6811 | 6811 |
|
6812 | 6812 | \pnum
|
6813 |
| -The \tcode{\&\&} operator groups left-to-right. The operands are both |
6814 |
| -contextually converted to \keyword{bool}\iref{conv}. |
6815 |
| -The |
6816 |
| -result is \keyword{true} if both operands are \keyword{true} and |
6817 |
| -\keyword{false} otherwise. Unlike \tcode{\&}, \tcode{\&\&} guarantees |
6818 |
| -left-to-right evaluation: the second operand is not evaluated if the |
6819 |
| -first operand is \keyword{false}. |
| 6813 | +The \tcode{\&\&} operator groups left-to-right. |
| 6814 | +The operands are both contextually converted to \keyword{bool}\iref{conv}. |
| 6815 | +The result is |
| 6816 | +\keyword{true} if both operands are \keyword{true} and |
| 6817 | +\keyword{false} otherwise. |
6820 | 6818 |
|
6821 | 6819 | \pnum
|
6822 |
| -The result is a \tcode{bool}. |
6823 | 6820 | \indextext{operator!side effects and logical AND}%
|
6824 |
| -If the second expression is evaluated, |
6825 |
| -the first expression is sequenced before |
6826 |
| -the second expression\iref{intro.execution}. |
| 6821 | +The right operand is not evaluated if the left operand evaluates to \keyword{false}. |
| 6822 | +The evaluation of the left operand is sequenced before\iref{intro.execution} |
| 6823 | +the evaluation (if any) of the right operand. |
| 6824 | +\begin{note} |
| 6825 | +The former behavior is sometimes called "short-circuiting". |
| 6826 | +The \tcode{&} operator guarantees neither short-circuiting nor left-to-right evaluation. |
| 6827 | +\end{note} |
6827 | 6828 |
|
6828 | 6829 | \rSec2[expr.log.or]{Logical OR operator}%
|
6829 | 6830 | \indextext{expression!logical OR}%
|
|
6837 | 6838 | \end{bnf}
|
6838 | 6839 |
|
6839 | 6840 | \pnum
|
6840 |
| -The \tcode{||} operator groups left-to-right. The operands are both |
6841 |
| -contextually converted to \keyword{bool}\iref{conv}. |
| 6841 | +The \tcode{||} operator groups left-to-right. |
| 6842 | +The operands are both contextually converted to \keyword{bool}\iref{conv}. |
6842 | 6843 | The result is
|
6843 | 6844 | \keyword{true} if either of its operands is \keyword{true}, and
|
6844 |
| -\keyword{false} otherwise. Unlike \tcode{|}, \tcode{||} guarantees |
6845 |
| -left-to-right evaluation; moreover, the second operand is not evaluated |
6846 |
| -if the first operand evaluates to \keyword{true}. |
| 6845 | +\keyword{false} otherwise. |
6847 | 6846 |
|
6848 | 6847 | \pnum
|
6849 |
| -The result is a \keyword{bool}. |
6850 | 6848 | \indextext{operator!side effects and logical OR}%
|
6851 |
| -If the second expression is evaluated, |
6852 |
| -the first expression is sequenced before |
6853 |
| -the second expression\iref{intro.execution}. |
| 6849 | +The right operand is not evaluated if the left operand evaluates to \keyword{true}. |
| 6850 | +The evaluation of the left operand is sequenced before\iref{intro.execution} |
| 6851 | +the evaluation (if any) of the right operand. |
| 6852 | +\begin{note} |
| 6853 | +The former behavior is sometimes called "short-circuiting". |
| 6854 | +The \tcode{|} operator guarantees neither short-circuiting nor left-to-right evaluation. |
| 6855 | +\end{note} |
6854 | 6856 |
|
6855 | 6857 | \rSec2[expr.cond]{Conditional operator}%
|
6856 | 6858 | \indextext{expression!conditional operator}%
|
|
0 commit comments