Compiler warnings are your friend!

Sir Fredrick

Guest
Oct 14, 1999
4,375
0
0
Yes, it's true.
I spent several hours trying to help a co worker fix an odd problem with his program: it worked in debug mode, but not in release. After trying just about everything under the sun, I noticed that one of his functions of type bool was only returning a value under certain conditions...in fact, it never returned true, ever.

Of course the compiler knew what was wrong all along.
Warning: Not all control paths return a value.

I never looked at the warnings because I assumed he would have taken care of them. That'll teach me.
 

outoftheblue

Senior member
Mar 5, 2001
575
0
0
Heh... debugging is great fun...

What language were you using? I've yet to encounter a warning from javac.... last time it was bitching at me that a variable might not have been initialized (I initialized it inside an if)... but that was a fatal error and it wouldn't let me compile.

Isn't it my problem if I create a NullPointerException?? ;)
 

Jzero

Lifer
Oct 10, 1999
18,834
1
0


<< Heh... debugging is great fun...

What language were you using? I've yet to encounter a warning from javac.... last time it was bitching at me that a variable might not have been initialized (I initialized it inside an if)... but that was a fatal error and it wouldn't let me compile.

Isn't it my problem if I create a NullPointerException?? ;)
>>



I get warnings from javac. It mostly happens when you use a deprecated API function.