minimal evaluation

TomD t_demmer at nospam.web.de
Mon Apr 6 12:33:25 PDT 2009


Qian Xu Wrote:

> Hi All,
> 
> Is minimal evaluation always enabled in D?
> 
> I want to write a function IsNull(), so that I can check the precondition as
> follows:
> 
>   if (isNull(foo) ||
>       isNull(foo.getBar) ||
>       isNull(foo.getBar.getBar2)
>   {
>     return false;
>   }
>   // normal code goes here
> 
> If an argument is null, the IsNull() will return false. Internally it will
> be logged to console as well.
Make it return true then. An "or" is true when it hits the first
true expression. 

Ciao
TomD



More information about the Digitalmars-d mailing list