ERROR: Control may reach end of non-void function /

If you call the function with a first argument of 0 the loop is never executed and the return statement is, thus, never reached. Falling of the end of a non-void function is undefined behavior.

My personal guess is that the return statement was meant to one level up, i.e., in the out block: this would guarantee that the function always returns a value and the warning would go away.

Leave a Comment