November 21, 2015 Short-circuit evaluation in D | ||||
---|---|---|---|---|
| ||||
Hello. From http://dlang.org/expression.html#OrOrExpression and the subsequent AndAndExpression section it is clear to me that D does indeed employ short-circuit evaluation true to being part of the C family. But I am disappointed to note that D is not mentioned at https://en.wikipedia.org/wiki/Short-circuit_evaluation. I would edit it myself but the table also mentions eager operators and I'm not sure whether D has any such operators i.e. whether & and | are supposed to be eager in D as they are said to be (as per the table) in C++. So I request someone more knowledgeable about D than me to do the edit and respond here too. Thanks. -- Shriramana Sharma, Penguin #395953 |
November 23, 2015 Re: Short-circuit evaluation in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shriramana Sharma | On Saturday, 21 November 2015 at 13:48:06 UTC, Shriramana Sharma wrote:
> Hello. From http://dlang.org/expression.html#OrOrExpression and the subsequent AndAndExpression section it is clear to me that D does indeed employ short-circuit evaluation true to being part of the C family.
>
> But I am disappointed to note that D is not mentioned at https://en.wikipedia.org/wiki/Short-circuit_evaluation.
>
> I would edit it myself but the table also mentions eager operators and I'm not sure whether D has any such operators i.e. whether & and | are supposed to be eager in D as they are said to be (as per the table) in C++.
>
> So I request someone more knowledgeable about D than me to do the edit and respond here too.
>
> Thanks.
&& and || short circuit.
&, | and ^ do not short circuit.
|
Copyright © 1999-2021 by the D Language Foundation