Re: warnings, errors;source code is included



Of course, since he used exit(0) at the end of main, we never get to the
end of main (exit does not return control to the calling function).  So it
would not matter what the return type of main was.  Yes it is true that
you should use "int main(...".

James.

--
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/


On Sun, 14 Nov 1999, David Benson wrote:

> Though `void main()' suppresses the compiler warnings,
> the calling function will assume main's exit status
> is to be the exit status for the process.
> 
> In other words, if you want to reliably exit and indicate
> that the run was successful, you should declare `int main()'
> and return 0 if you are exitting successfully.
> 
> Of course, in many gui environments, exit codes are
> just ignored... but you shouldn't assume that...
> 
> - Dave
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]