www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/04/16:42:44

From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT edu DOT ar>
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 <fighteer AT cs DOT com> 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.
><a href="http://www.cs.indiana.edu/finger/mofo.ssl.berkeley.edu/korpela/w">
>Click here for more info.</a>
********************************************************************************
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 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019