Skip to content
Prev 48524 / 63424 Next

operation on ‘numsels’ may be undefined

Hi Kevin,
On 06/23/2014 10:28 PM, Kevin Ushey wrote:
As the former? Isn't it that `prefix-++` has precedence over `=`? Also
according to the standard, `prefix-++` must perform the increment
*before* returning the incremented value. So I'm still a little bit
confused about this warning. Although I would understand it if
`suffix-++` was used instead of `prefix-++`:

     numsels = numsels++;

In that case the incrementation happens *after* the right value
of the assignment is evaluated but it's undefined whether it will
happen before or after the assignment itself (on my machine it
happens after).
Nice slides. Pretty entertaining! The numsels = numsels++ case is
actually discussed at slide 142. Thanks for the link!

H.