c - How to get VS or Xcode warning with something like "x = x++"? -
in spirit of undefined behavior associated sequence points such âx = ++xâ undefined?, how 1 compiler complain such code?
specifically, using visual studio 2010 , xcode 4.3.1, latter osx app, , neither warned me this. cranked warnings on vs2010 "all", , happily compiled this. (for record, vs2010's version added 1 variable xcode's version kept variable unchanged.)
afaik, visual studio not detect such situations. , i'm not convinced there's point in doing that. i'd warning obvious case have educational value, not practical value. in general case issue in question takes place in situations *p = ++*q
when p
, q
happen point same object. needless say, not detectable compiler.
Comments
Post a Comment