On 23 May 2006, <[EMAIL PROTECTED]> wrote:
> Original message from prad <[EMAIL PROTECTED]>:
>
> > suppose that you have 2 conditions A and B where B take a lot of    
> > effort to determine (eg looking for a string match in a huge file). 
> >
> > either A or B needs to be true before you can execute 'this'.
> >
> > the 2 if statements below are equivalent i think:
> > 
> > if A or B: 
> > do this 
> > 
> > if A: 
> > do this 
> > elseif B: 
> > do this 
> > 
> > now, do they work the same way? 
> > 
> 
> Both of these forms are equivalent only in languages which
> short-circuit Boolean expressions (not all language implement
> short-circuiting...).  C/C++ both support this feature.
[...]

    The only language I can think of that (1) does complete evaluations,
(2) is still in use today, and (3) has a significant amount of code
written in it, is Pascal.  The Wirth-Jensen definition of Pascal
specified complete evaluations.  The once popular Borland Pascal
implemented that as an option.  Don't know about gpc.

    Regards,

    Liviu Daia

-- 
Dr. Liviu Daia                                  http://www.imar.ro/~daia

Reply via email to