🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.programmer.codewarrior
Article #20

Re: ANSI standards

#20
From: Lou Pecora
Date: Fri, 15 Dec 1995 01:27
39 lines
1953 bytes
In article <4aptvk$q7b@newsbf02.news.aol.com>, mwron@aol.com (MW Ron) wrote:

> hammond_g@drkclu.meng.ucl.ac.uk (G. Ruth Hammond) writes:
> 
> >Using Metrowerks CodeWarrior C++ on my LC475 I declare main as void
> main(void)
> >and it compiles ok, but using DEC C++ on an alpha it insists on int
> main(void) 
> >and won't compile otherwise. CodeWarrior won't compile it with an int
> main
> >(void), it gives link errors. 
> >-- % snip % --
> >which one is the correct ANSI standard? and is there a way to ensure my
> source
> >will compile without modification on both platforms (maybe with #ifdef?)
> 
> Hi Guy there is no reason for this not to work returning an integer is the
> SOP in C++ so much so that you don't even declare it usually just write
> main().   I have a feeling the problemis you have selected to treat all
> warnings as an error and do not have a return 0;  as your last line in
> main().
> 
> Many compilers will return a  zero for you from main() [ it might be
> called for in the standard, but I am not sure ]  so your DEC compiler
> probably does this for you.  
> 
> If this is not the problem let me know, but this should not be a problem. 

Yeah, I've done int main (whatever) with return 1 or 0 and it works fine.

-- 
Lou Pecora
code 6341
Naval Research Lab
Washington  DC  20375
USA
pecora@zoltar.nrl.navy.mil
/* My views are not those of the U.S. Navy. 
   If you want their views, you have to go to war. */
Technical Details
Message-ID: <pecora-1412952027320001@esp225.nrl.navy.mil>
Path: arc1-ca.pugleaf.net!esp225.nrl.navy.mil!user
References: <1995Dec14.120627.31590@ucl.ac.uk> <4aptvk$q7b@newsbf02.news.aol.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!esp225.nrl.navy.mil!user
From: pecora@zoltar.nrl.navy.mil (Lou Pecora)
Newsgroups: comp.sys.mac.programmer.codewarrior,comp.lang.c++
Subject: Re: ANSI standards
Date: Thu, 14 Dec 1995 20:27:32 -0500
Organization: Naval Research Lab
Message-ID: <pecora-1412952027320001@esp225.nrl.navy.mil>
References: <1995Dec14.120627.31590@ucl.ac.uk> <4aptvk$q7b@newsbf02.news.aol.com>
NNTP-Posting-Host: esp225.nrl.navy.mil
X-Newsreader: Yet Another NewsWatcher 2.0