Am 02.02.2016 08:34 schrieb "Anthony Walter" <sys...@gmail.com>: > > Sven, > > I missed this post when you made it a two days ago. If someone hasn't already asked, does your implementation support short circuit evaluation? > > For example: > > BasketCount := IfThen(ShoppingList <> nil, ShoppingList.Count, 0); > > Where evaluating ShoppingList.Count will cause an exception if ShoppingList is nil. > > Also the reverse should short circuit as well: > > BasketCount := IfThen(ShoppingList = nil, 0, ShoppingList.Count);
You're mixing up two things. Short circuit evaluation in terms of Pascal is that in expressions using "and" and "or" the evaluation is aborted if the result is already determined. This is controlled by a compiler directive and is respected by all Boolean expressions. What you mean is that the compiler does not evaluate all branches of the if and that is the main reason I introduced this intrinsic. In fact the IfThen() behaves just like an ordinary if-statement in that regard as I had mentioned in my original mail. Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal