Mike Mason wrote:
Should the following chained assignment:
writes[execname()] = total_io[execname()] += $return
be equivalent to:
writes[execname()] += $return total_io[execname()] +=
$return
Not if we mimic C's operator associativity, which is right-to-left for
assignment operators. So your statement is effectively:
writes[execname()] = ( total_io[execname()] += $return )
Or equivalent to:
total_io[execname()] += $return
writes[execname()] = total_io[execname()]
Also, if you look at the -p1 output, it will show you the explicit
associativity that was parsed. e.g.
$ stap -ue 'probe begin { a = b += c }' -p1
# parse tree dump
# file <input>
probe begin{
(a) = ((b) += (c))
}
They yield different results in a couple scripts I tried (see below).
For example, it appears that writes[] gets assigned total_io[] instead
of += $return.
That's correct. But if you're seeing inconsistent results, please file
a bug and commit a testcase.
Josh