I've googled and just can't seem to find the answer to this simple question.
Working on a legacy code base (ported to Linux recently, and slowly updating to a new compiler) and I see a lot of
int myfunction(...)
{
// no return...
}
I know the implicit return TYPE of a function is int, but what is the implicit return VALUE when no return is specified. I've tested and gotten 0, but that's only with gcc. Is this compiler specific or is it standard defined to 0?
EDIT: 12/2017 Adjusted accepted answer based upon it referencing a more recent version of the standard.
Such a thing is possible, but only under the assumption that the return value of the function is never used. The C11 standard says in para 6.9.1:
(AFAIR previous version of the standard had similar wording)
So it would be a good idea to transform all the functions of that sort that you have to
void
functions, so no user of such a function could be tempted to use the return value.