Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!POSTGRES.BERKELEY.EDU!dillon From: dillon@POSTGRES.BERKELEY.EDU (Matt Dillon) Newsgroups: comp.sys.amiga Subject: Re: Lattice C 5.0 Message-ID: <8812192102.AA25347@postgres.Berkeley.EDU> Date: 19 Dec 88 21:02:47 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 25 You can't return an error code from main() via return. The only way to return an error code is with exit() or _exit(). returning from main() always generates an error code of 0. This is why main() might be declared void. Why? Lots of people let main() fall through to exit a program, which means the 'return value' would otherwise be garbage. -Matt : I don't know about the ANSI standard but the way Lattice 4.02 worked :(and I think version 5.0 works the same way) you get an error if you've :specified a prototype for a function and then not complied with it. But if :you don't use the prototyping feature you won't get the errors. The main :difference I've noticed is 5.0 has a lot more prototypes built for :functions supplied by Lattice. In particular, I ran afoul of their :definition of main() as a void in stdlib.h. I'm used to declaring main() :an int so I can return an error code. : :--Fabbian Dufoe : 350 Ling-A-Mor Terrace South : St. Petersburg, Florida 33705 : 813-823-2350 : :UUCP: ...codas!usfvax2!jc3b21!fgd3 : ...uunet!pdn!jc3b21!fgd3