This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bamboozled --a newbie dilemma


Kevin Phillips wrote:
> On Thu, 19 Aug 1999 12:43:00 +0100, Liyang Hu <liyang@iss-dsp.com> wrote:
> >> I've tried  it with just " main() " in the code instead of
> >> void main()
> >i prefer void main(void), just to spell out the obvious

> Use "int main(void)" (and don't forget "return 0;"
> before the closing brace at the end of main() ).

Agreed. main() should definitely return an int.
However, I have yet to come across a case where it would
> Using void main(void) invokes undefined behaviour (unless you
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> are working on an unhosted system).

Afaict, the C startup code just assumes a return value of 0...

Either way, I usually use int main(void)... unless I start to get
sloppy like I did earlier... ^_^

Liyang
-- 
 /*\__________________________   ______________________________
|                             \ /                              \
|    Liyang Hu aka DenseBoy    |        ICQ #: 39391385         |
|    http://liyang.cjb.net/    |    <denseboy@a1tav1sta.net>    |
+------------------------------+--------------------------------+
|  HELP!!! I'm being held prisoner in /usr/games/lib!!          |
|   ___________________________________________________________/
 \*/ // get my public key at http://liyang.cjb.net/liyang.asc
 /*\ change the number in my address to letters to email me!! \*/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]