Short-circuit evaluation in D

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 23 01:28:52 PST 2015


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.


More information about the Digitalmars-d mailing list