News for hackers. Stuff that matters.
Re:What is C in practice? by JupiterMoon on Monday June 29, 2015 @05:21PM (#9801200)
Why does this have to be a valid program? There is obviously a chance that x is undefined at line 3 so why not allow the compiler to throw an error?
Re:What is C in practice? by Ded7xSEoPKYNsDd on Monday June 29, 2015 @06:18PM (#9801544)
Not necessarily. Just because the compiler can't prove that g only returns true iff f also returned true doesn't mean the programmer doesn't know it to actually be true.

So changing that behavior means that the compiler now rejects 40 years worth of correctly working legacy code (and some buggy code, as well). Newer languages (e.g. Java, C#) that don't have to support existing code can afford to do what you want and reject programs where a simple heuristic isn't enough to tell whether a variable is initialized or not.

Re:What is C in practice? by anon4 on Tuesday June 30, 2015 @02:07AM (#9803240)
You can already break a lot of programs with -Wall -Werror (I generally compile my code with both, but turn them off for libraries). Just hide the amazing optimisation behind an -foptimise-undefined-behaviour which you can only turn on if you've specified at least a significant portion of -Wall.
Re:What is C in practice? by GFK_of_xmaspast on Monday June 29, 2015 @09:46PM (#9802364)
So don't raise an error, instead publish a warning.