delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/10/14:21:18

From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Templates
Date: 10 Jun 1997 16:56:39 GMT
Organization: Oxford University, England
Message-ID: <5nk107$egt@news.ox.ac.uk>
References: <3 DOT 0 DOT 16 DOT 19970608164854 DOT 2e3f02e6 AT hem1 DOT passagen DOT se> <3399D9C3 DOT 2DB0 AT xl DOT ca> <5ngt7r$pph AT news DOT ox DOT ac DOT uk> <339CEA7B DOT 4DDE AT xl DOT ca>
NNTP-Posting-Host: sable.ox.ac.uk
Lines: 26
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Darren Grant (darn AT xl DOT ca) wrote:
: George Foot wrote:
: > 
: > Darren Grant (darn AT xl DOT ca) wrote:
: > 
: > :      void main();
: > 
: > This is wrong. In C++ the main function absolutely must return an int;
: > the strict type checking in C++ makes this very important. gcc
: > automatically switches the prototype to return int, but you ought to
: > declare it to return int explicitly yourself, and return a value.


: Thanks for poiting that out, but which C++ compilers choke on the void
: return?

To be fair, I don't know of any which by default stop execution, although
I haven't used many different ones (my time in TC lasted only until I
discovered DJGPP). However, it is illegal according to the ANSI standard
for C and the proposed standard for C++. If you want more information, try
the comp.lang.c FAQ (FTP from rtfm.mit.edu, or see the online HTML version
at http://www.eskimo.com/~scs/C-faq/top.html).

-- 
George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Merton College, Oxford

- Raw text -


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