changeset 18876:e6a4fa91a2f1 stable

doc: Clarify order of evaluation of compound assignment expressions * expr.txi: Add descriptive text and example to clarify the actual order of evaluation of assignment expressions that contain another assignment expression.
author Mike Miller <mtmiller@ieee.org>
date Tue, 17 Jun 2014 23:38:49 -0400
parents dd34502e5c3c
children 77d5e7661b8e
files doc/interpreter/expr.txi
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/expr.txi	Tue Jun 17 12:04:18 2014 -0400
+++ b/doc/interpreter/expr.txi	Tue Jun 17 23:38:49 2014 -0400
@@ -1237,8 +1237,19 @@
 @end example
 
 @noindent
-where @var{op} can be either @code{+}, @code{-}, @code{*}, or @code{/}.
-So, the expression
+where @var{op} can be either @code{+}, @code{-}, @code{*}, or @code{/},
+as long as @var{expr2} is a simple expression with no side effects.  If
+@var{expr2} also contains an assignment operator, then this expression
+is evaluated as
+
+@example
+@var{temp} = @var{expr2}
+@var{expr1} = (@var{expr1}) @var{op} @var{temp}
+@end example
+
+@noindent
+where @var{temp} is a placeholder temporary value storing the computed
+result of evaluating @var{expr2}.  So, the expression
 
 @example
 a *= b+1