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.
From the '89 standard as quoted in the new testament:
Flowing off the end of a function is equivalent to a return with no expression. In either case, the return value is undefined.
That standard usually expresses the on-the-ground behavior of pre-existing implementations.