Suresh Govindachar
<sgovindac...@yahoo.com> writes:

>>      > This isn't the first time you corrected me on the return value from
>>      > main when I'm making a test-case to demonstrate a compiler issue; I
>>      > honestly couldn't care less and my goal is to use the minimum amount
>>      > of characters and so following the standards doesn't come into it,
>>
>>     `int' is one character less than `void' ;-)
>>
>>
>> I was just about to write that :-P
>
> Well, I too was about to write that -- but didn't since with an int 
> return the body of main would need to change too, wouldn't it?
>
> Compare:
>        void main(){}
> with
>        int main(){ return 0;} // perhaps return is not needed?
>
> (I don't mind typing!)

Apart from what lh_mouse says about C++, in C if your function is
declared to return an int and there is no return statement the returned
value is undefined (not to be confused with undefined behavior, which
only happens on this case if you *use* the value returned by that
function.)

So you can omit the return at the end of `main' on your toy C program
unless you plan to use the process' exit value.


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to