Skip to content

Commit 0553160

Browse files
authored
Merge pull request #3248 from henrikt-ma/clarify-short-circuit-example
Don't give impression of undefined behavior being error
2 parents 0f1ed88 + e0cbaf7 commit 0553160

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

chapters/operatorsandexpressions.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ \section{Evaluation Order}\label{evaluation-order}
179179
Boolean b;
180180
Integer I;
181181
equation
182-
b = (I >= 1 and I <= n) and v[I]; // Invalid
183-
b = if (I >= 1 and I <= n) then v[I] else false; // Correct
182+
b = (I >= 1 and I <= n) and v[I]; // Unsafe, may result in error
183+
b = if (I >= 1 and I <= n) then v[I] else false; // Safe
184184
\end{lstlisting}
185185

186186
To guard square against square root of negative number use \lstinline!noEvent!:

0 commit comments

Comments
 (0)