I got this warning message
"warning: control reaches end of non-void function"
May I know exactly what does it mean?
And what is the difference between the compiling option -O2 and -O3?
Thanks for your help!
I got this warning message
"warning: control reaches end of non-void function"
May I know exactly what does it mean?
And what is the difference between the compiling option -O2 and -O3?
Thanks for your help!
Assumably, it means that you have to return a value using the return statement before the end of your function. This does not apply to void functions because a void function does not return a value.I got this warning message
"warning: control reaches end of non-void function"
May I know exactly what does it mean?
GCC Help: Options That Control OptimizationAnd what is the difference between the compiling option -O2 and -O3?
Last edited by anonytmouse; 01-29-2005 at 11:17 AM.
Quzah.Code:int foo( void ) { int x = 10; /* note, we've now reached the end of the function, and we aren't returning anything like we should. */ }
Hope is the first step on the road to disappointment.
thanks guys!
I went to the gcc website, have a look, don't understand what it is talking about.
I had tried both 02 and 03 and my program run faster when I used 02. But does 03 should run faster, since it is suppose to optimize further?
> But does 03 should run faster, since it is suppose to optimize further?
Maybe.
There are way too many factors to take into account for each increment in optimisation level to always produce a gain. -O3 is better than -O2 on some programs (an average set IIRC), but not all programs.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
ok, thanks for the help again!