Jump to content

Talk:Short-circuit evaluation: Difference between revisions

Line 24:
 
: +1 —''[[User:Ruud Koot|Ruud]]'' 19:17, 20 April 2011 (UTC)
 
== Compiler optimisations? ==
A variant of this issue arises when the second part of an expression might cause a disaster such as division by zero or indexing out of bounds, as in
:<code>while i > 0 and A(i) ''etc.'' do i:=i - 1;</code>
where an attempt at A(0) would be improper. The first test protects the second against evaluation only with short-circuiting. A compiler might generate code that ''always'' evaluates both parts, or, ''consistently'' short-circuits, or, short-circuits only if the first part is a certain sort of expression, such as a boolean variable but not if a function...
 
 
: Text moved as unclea if it describes fully compliant compiler - If language states short-circuit then compiler should be compliant. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 16:07, 28 April 2015 (UTC)
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.