delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/09/15:37:04

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Warning message
Date: Tue, 05 Aug 1997 21:55:47 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 32
Message-ID: <33E7A163.321A@cs.com>
References: <33E6C03F DOT 215F AT starnets DOT ro>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp215.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Korenschi Francisc Eduard wrote:
> 
> Hello from Romania,
> 
>   What does the message "Return type for main changed to integer type"
> mean ?
>   (I used the -Wall option)

'void', or any other type, is not a legal return type for main(). 
According to the ANSI standard, main() must always return an integer. 
In C, this isn't such a big issue for the compiler (it's still wrong!),
but in C++, it's so important that the compiler will automatically
convert the type to int if you don't specify it that way yourself.  When
you turn on all warnings, it mentions this.

BTW, the issue of void main() is discussed at length in the comp.lang.c
Frequently Asked Questions at
http://www.eskimo.com/~scs/C-faq/top.html.  Look at questions 11.12
through 11.16.  The FAQ also gives complete ANSI references by section
number.

-- 
John M. Aldrich <fighteer AT cs DOT com>                      

* Anything that happens, happens.
* Anything that, in happening, causes something else to happen,
  causes something else to happen.
* Anything that, in happening, causes itself to happen again, happens
  again.
* It doesn't necessarily do it in chronological order, though.
 
                                       --- Douglas Adams

- Raw text -


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