[comp.lang.pascal] Boolean Evaluation

D7314@uwavm (Patrick Ryan) (02/19/88)

In answer to Bill Smith's query about the evaluation or lack thereof
of the second part of a logical AND:
This condition is known as Short Circuit Boolean (SCB).  SCB
definitely is *not* standard in the Pascal language.  It is standard in
Modula2.  SCB is a nice feature of a compiler, but certainly can be
coded around.  The "side effects" of attempting to use SCB in a program
where the compiler does not support it are, unfortunately, insidious.
The program will have absolutely no problem in most cases.  Only when
the second expression evaluates an undefined case (such as a pointer
that has not been initialized, or an array subscript that is out of
bounds) will an error message be issued (at run-time).  Mr. Smith's
concerns about the use of SCB in Pascal are well grounded.  The actual
use of SCB in Pascal does not seem all that prevelant (so far as I have
seen) but it is a definite issue of concern to portability of Pascal
code... Even if your compiler supports it, you should not use it!

                                        Patrick Ryan
                                 University of Washington
                                Academic Computer Services
Std. Disclaimer
My opinions, profound as they may be, do not in any way reflect the
official opinions of my employer.