News for hackers. Stuff that matters.
Re:Old GCC easter egg (aka implementation-defined behavior) by pmjordan on Sunday October 03, 2010 @09:58AM (#1752709)
GCC 4 has seen big improvements in that area, especially with -Wall. Other compilers (except clang) not so much.

FWIW, GCC 4.2.1 on OSX 10.6 silently accepts

  x += ++x;
by default. -Wall catches it, at least. I'm trying to think of a reason why the warning might not be on by default - I can only assume it's either lumped in with some other, less reliable undefined behaviour detection, such as aliasing. -Wall doesn't even catch trivial cases of aliasing though, such as

  int* y = &x;
  x += ++*y;
Maybe it's the default in a newer version, or this is Apple messing with me, not GNU.
Re:Old GCC easter egg (aka implementation-defined behavior) by jedbrown on Sunday October 03, 2010 @10:21AM (#1752735)
Both gcc-4.5.1 and clang-1.1 (from LLVM 2.7) both silently accept the second case with -Wall -Wextra -pedantic.
Re:Old GCC easter egg (aka implementation-defined behavior) by joe_bleau on Sunday October 03, 2010 @01:06PM (#1753070)
PC-lint (http://www.gimpel.com/) gives a "Warning 564: variable 'x' depends on order of evaluation" for your first example, but is silent on the second.