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!
Printable View
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.Quote:
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 OptimizationQuote:
And what is the difference between the compiling option -O2 and -O3?
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. */
}
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.
ok, thanks for the help again! :p