www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Short-circuit evaluation in D

reply Shriramana Sharma <samjnaa_dont_spam_me gmail.com> writes:
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
Nov 21 2015
parent deadalnix <deadalnix gmail.com> writes:
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.
Nov 23 2015