public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* warning: return type of main is not int
@ 1998-01-16  1:51 Byeong-ryeol Kim
  1998-01-16 19:49 ` Joe Buck
  1998-01-17  1:40 ` Joseph H. Buehler
  0 siblings, 2 replies; 7+ messages in thread
From: Byeong-ryeol Kim @ 1998-01-16  1:51 UTC (permalink / raw)
  To: egcs

 I often met this warning after installing egcs on rh 5.0.
 Is this harmless?
 The typical code is as follows:
....
void main(int argc, char *argv[])
{
    int sock, i;
    
    if ((argc > 1) && (strcmp(argv[1], "-v") == 0))
        printf("%s", version);
    
    sock = i365_probe();
    for (i = 0; i < sock; i++) {
        printf("Socket %d:\n", i);
        dump_sock(i);
    }
}
...

 "Where there is a will, there is a way."  jinbo21@soback.kornet.nm.kr 
                                           kbeyl@kids.kotel.co.kr      
  For the future of you and me!            hitel: jinbo21


^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: warning: return type of main is not int
@ 1998-01-16 19:49 Mike Stump
  1998-01-19  2:30 ` Alexandre Oliva
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Stump @ 1998-01-16 19:49 UTC (permalink / raw)
  To: egcs, jinbo21

> Date: Fri, 16 Jan 1998 10:52:41 +0900 (KST)
> From: Byeong-ryeol Kim <jinbo21@soback.kornet.nm.kr>
> To: egcs@cygnus.com

>  I often met this warning after installing egcs on rh 5.0.
>  Is this harmless?
> void main(int argc, char *argv[])

This is reasonably safe, but wrong for C++.  The return type should be
int not void.  Why bother asking us, it takes less time to fix the
code as the compiler instructs.  return 0, if you don't know of a
better value to return.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1998-01-19  2:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-16  1:51 warning: return type of main is not int Byeong-ryeol Kim
1998-01-16 19:49 ` Joe Buck
1998-01-16 20:09   ` Byeong-ryeol Kim
1998-01-16 20:09     ` Joe Buck
1998-01-17  1:40 ` Joseph H. Buehler
1998-01-16 19:49 Mike Stump
1998-01-19  2:30 ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).