dlr bug
[mcs.git] / docs / ecma334 / 14.11.xml
blob4c70ef808d761c48973fa085cb6dbafc01ba4ccf
1 <?xml version="1.0"?>
2 <clause number="14.11" title="Conditional logical operators">
3   <paragraph>The &amp;&amp; and || operators are called the conditional logical operators. They are also called the  &quot;short-circuiting&quot; logical operators. <grammar_production><name><non_terminal where="14.11">conditional-and-expression</non_terminal></name> : <rhs><non_terminal where="14.10">inclusive-or-expression</non_terminal></rhs><rhs><non_terminal where="14.11">conditional-and-expression</non_terminal><terminal>&amp;&amp;</terminal><non_terminal where="14.10">inclusive-or-expression</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="14.11">conditional-or-expression</non_terminal></name> : <rhs><non_terminal where="14.11">conditional-and-expression</non_terminal></rhs><rhs><non_terminal where="14.11">conditional-or-expression</non_terminal><terminal>||</terminal><non_terminal where="14.11">conditional-and-expression</non_terminal></rhs></grammar_production></paragraph>
4   <paragraph>The &amp;&amp; and || operators are conditional versions of the &amp; and | operators: <list><list_item> The operation x &amp;&amp; y corresponds to the operation x &amp; y, except that y is evaluated only if x is true. </list_item><list_item> The operation x || y corresponds to the operation x | y, except that y is evaluated only if x is false. </list_item></list></paragraph>
5   <paragraph>An operation of the form x &amp;&amp; y or x || y is processed by applying overload resolution (<hyperlink>14.2.4</hyperlink>) as if the operation was written x &amp; y or x | y. Then, <list><list_item> If overload resolution fails to find a single best operator, or if overload resolution selects one of the predefined integer logical operators, a compile-time error occurs. </list_item><list_item> Otherwise, if the selected operator is one of the predefined boolean logical operators (<hyperlink>14.10.2</hyperlink>), the operation is processed as described in <hyperlink>14.11.1</hyperlink>. </list_item><list_item> Otherwise, the selected operator is a user-defined operator, and the operation is processed as described in <hyperlink>14.11.2</hyperlink>. </list_item></list></paragraph>
6   <paragraph>It is not possible to directly overload the conditional logical operators. However, because the conditional logical operators are evaluated in terms of the regular logical operators, overloads of the regular logical operators are, with certain restrictions, also considered overloads of the conditional logical operators. This is described further in <hyperlink>14.11.2</hyperlink>. </paragraph>
7 </clause>