How to get VS or Xcode warning with something like "x = x++"?
Posted
by
Jim Buck
on Stack Overflow
See other posts from Stack Overflow
or by Jim Buck
Published on 2012-07-07T03:01:10Z
Indexed on
2012/07/07
3:15 UTC
Read the original article
Hit count: 126
In the spirit of undefined behavior associated with sequence points such as “x = ++x” is it really undefined?, how does one get the compiler to complain about such code?
Specifically, I am using Visual Studio 2010 and Xcode 4.3.1, the latter for an OSX app, and neither warned me about this. I even cranked up the warnings on VS2010 to "all", and it happily compiled this. (For the record, VS2010's version added 1 to the variable where Xcode's version kept the variable unchanged.)
© Stack Overflow or respective owner