38 lines
1.5 KiB
Markdown
38 lines
1.5 KiB
Markdown
[expr.log.and]
|
||
|
||
# 7 Expressions [[expr]](./#expr)
|
||
|
||
## 7.6 Compound expressions [[expr.compound]](expr.compound#expr.log.and)
|
||
|
||
### 7.6.14 Logical AND operator [expr.log.and]
|
||
|
||
[logical-and-expression:](#nt:logical-and-expression "7.6.14 Logical AND operator [expr.log.and]")
|
||
[*inclusive-or-expression*](expr.or#nt:inclusive-or-expression "7.6.13 Bitwise inclusive OR operator [expr.or]")
|
||
[*logical-and-expression*](#nt:logical-and-expression "7.6.14 Logical AND operator [expr.log.and]") && [*inclusive-or-expression*](expr.or#nt:inclusive-or-expression "7.6.13 Bitwise inclusive OR operator [expr.or]")
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L7744)
|
||
|
||
The && operator groups left-to-right[.](#1.sentence-1)
|
||
|
||
The operands are both
|
||
contextually converted to bool ([[conv]](conv "7.3 Standard conversions"))[.](#1.sentence-2)
|
||
|
||
The
|
||
result is true if both operands are true andfalse otherwise[.](#1.sentence-3)
|
||
|
||
Unlike &, && guarantees
|
||
left-to-right evaluation: the second operand is not evaluated if the
|
||
first operand is false[.](#1.sentence-4)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L7753)
|
||
|
||
The result is a bool[.](#2.sentence-1)
|
||
|
||
If the second expression is evaluated,
|
||
the first expression is sequenced before
|
||
the second expression ([[intro.execution]](intro.execution "6.10.1 Sequential execution"))[.](#2.sentence-2)
|