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

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -