delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/18/21:32:13

From: bd733 AT rgfn DOT epcc DOT edu (Jason M. Daniels)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Newbie question (error that needs cc1plus.exe file)
Date: 18 May 1997 22:56:52 GMT
Organization: The Rio Grande Free-Net, El Paso Community College, El Paso, TX
Message-ID: <5lo1fk$t05@news.epcc.edu>
References: <19970517125400 DOT IAA20150 AT ladder02 DOT news DOT aol DOT com> <337E4F73 DOT 36E3 AT cs DOT com> <5ln1ml$2p4 AT news DOT ox DOT ac DOT uk>
NNTP-Posting-Host: rgfn.epcc.edu
Lines: 23
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

George Foot (mert0407 AT sable DOT ox DOT ac DOT uk) wrote:
> John M. Aldrich (fighteer AT cs DOT com) wrote:

> : And, of course, add a "return 0;" at the end of main().

> Is this strictly necessary? I was glancing through the ANSI standard the
> other day (as one does) and it said that if main() reaches the end of the
> function without encountering a return statement, it should assume a
> return value of 0. Now gcc complains about this; is this non-compliance? 

No; gcc is only absolutely, 100% ANSI when used with the '-ansi' switch. 
('-pedantic' will complain about more things but I'm not totally sure if 
it enforces more ANSI compliance.)

> I still think it's a good idea to put a return in anyway, for the same
> reason I prototype all my functions and assign them return types.

Right. It's a good stylistic habit to have.

--
Jason Daniels -- bd733 AT rgfn DOT epcc DOT edu
Linux: The choice of a GNU generation.
Winblows 95: The world's best-selling computer virus.

- Raw text -


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