delphi - break condition to OR and AND operators in an IF Statement -
the if statement , other boolean comparison smart enought stop @ first false value when evaluating a , b , c , d , @ first true value when evaluating a or b or c or d.
what name of behavior? 
 compiler optimization? if so, there way disable compiler directive? 
this called 'boolean short-circuit evaluation', form of 'lazy evaluation'.
you can tell compiler either use or not use feature using compiler directives:
complete evaluation     lazy evaluation {$b+}                   {$b-} {$booleval on}          {$booleval off}  but notice isn't only optimisation, since feature allows write code like
if (length(myarr) > 0) , (myarr[0] = my_val) which work if myarr[0] doesn't exist. rather common, actually.
Comments
Post a Comment