From: "Salvador Eduardo Tropea (SET)" To: korpela AT islay DOT ssl DOT berkeley DOT edu, djgpp AT delorie DOT com Subject: Re: HELP MEEEEEE!!!! Date: Wed, 4 Sep 1996 16:43:08 +0300 (GMT) Message-ID: <9609041643.aa11427@ailin.inti.edu.ar> Hi main funs, I don't want another war of main style declarations, but ... the void main() is very suitable for some platform like a microcontroller, if you put int main() in a microcontroller what's the use of the return value!!!, and you'll save some space. SET In answer to the following mail >>>John M. Aldrich wrote in article >>><32289180 DOT 543D AT cs DOT com>... >> >>>> P.S.: I won't go into it now, but 'void main()' is not the right way to >>>> define main. If that's what your book recommends, I'd get a better one. >>>> >>>That is how it is taught in many schools John, in introductory C++ CS >>>courses! To the point that it is mentally engrained! >"void main()" being taught doesn't make it the right way to define main. >If someone taught you that they shouldn't be teaching C. main() MUST >return int. The following are acceptable.... >main() >int main() >int main(void) >int main(int argc, char **argv) >> >>Hmm, my thoughts on this has always been that main can be declared >>several ways, depending on your needs. >Yes, but it MUST always return int. Period. Exclamation point! >> Thus, for most simple programs (which is usually >>what you learn in introductory courses), you'll use.. >> >>void main() >And you'll do it incorrectly. "void main()" is not legal C. It invokes >undefined behavior. There is no guarantee that the program will work >properly if main is declared void. >>There isn't any one required way to declare main(). It just depends >>on your needs. >I'll say it again just to be sure you heard me. "main()" must be declared >"int"!!!!!!!!!!!! >Eric >-- >Eric Korpela | An object at rest can never be >korpela AT ssl DOT berkeley DOT edu | stopped. > >Click here for more info. ******************************************************************************** Salvador Eduardo Tropea (SET) - salvador AT inti DOT edu DOT ar Work: INTI (National Institute of Industrial Technology) Sector: ICE (Electronic Control & Instrumentation) Post (Home): Curapaligue 2124 - Caseros (1678)- Buenos Aires - Argentina