Mail Archives: djgpp/2001/02/19/22:56:17
On Tue, 20 Feb 2001 02:50:40 GMT, "pwillard" <pwillard AT mindspring DOT com>
wrote in comp.os.msdos.djgpp:
> I have a warning that says: "control reaches end of non-void function". What
> would be some reasons I would get this?
You SHOULD post the code of the function that causes the message. But
consider:
int compare(int a, int b)
{
if (a < b)
return -1;
else if (a > b)
return 1;
}
There are three return points in this function, the two return
statements and the "}" that ends the function. Depending on the
values passed to the function when it is called, it might return -1,
it might return 1, or it might hit the "}" and return ??? That final
possibility will happen if a and b are equal.
--
Jack Klein
Home: http://JK-Technology.Com
- Raw text -