On Wed, 03 Nov 1999 17:52:34 +0100, Stef Epardaud <stef(a)lunatech.com> said:
window.c:2409: warning: `w' might be used uninitialized in this
function
At least for the IBM xlc compiler, you can get these quite easily. The usual
cause is code similar to this:
int foo, bar;
struct baz *quux;
while(frobozz(quux) {
if (quux->myflag) bar = quux->value;
quux = quux->next;
}
foo = bar;
This will draw a message on 'bar'. Even though *YOU* know that the
while loop *will* find a value of quux->myflag that's true and therefor
set 'bar' (because frobozz will call assert if it doesn't find one ;), the
compiler doesn't know that - it just sees that you CAN drop out of the
while without ever setting 'bar'. The compiler can't know what the
rest of your program will actually do at run time.
It's impossible to 100% fix this and eliminate all erroneous warnings,
as that's basically the Turing Halting Problem... ;)
--
Valdis Kletnieks
Operating Systems Analyst
Virginia Tech