I know that in C compilers the main()
function is called by the _start()
function which has code something like this:
exit(main());
The function will return an implementation-defined value. For example, in C++, main
implicitly returns 0
. In this case of a void
main then this would simply be returned by _start
. However, there are virtually no implementations that would allow any arbitrary return type- it's baked into the operating system that a process exits with an integral value.
Standard implementations of C expect main
to return int
just because it is defined that way in the C standard. Returning something other than int
(or a type compatible with int
) usually results in undefined behaviour—meaning there is no way to tell what will happen.
However, there are non-standard implementations of C, for example, the Plan 9 operating system uses void main()
, here is a list their utilities' source code. Plan 9 C code is quite a bit different to K&R, ANSI, C99 or C11. Here's a link explaining how Plan 9 uses the C language.