“x = ++x” is it really undefined?

前端 未结 6 813
悲&欢浪女
悲&欢浪女 2020-12-16 15:50

I am using Coverity Prevent on a project to find errors.

It reports an error for this expression (The variable names are of course changed):

x=
   (a         


        
6条回答
  •  臣服心动
    2020-12-16 16:19

    The statement x = ++x; writes to the variable x twice before hitting the sequence point and hence the behavior is undefined.

提交回复
热议问题