🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: ANSI standards

#17
From: MW Ron
Date: Thu, 14 Dec 1995 19:29
32 lines
1627 bytes
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. 



Ron

   METROWERKS               Ron Liechty
"Software at Work"    MWRon@metrowerks.com
Technical Details
Message-ID: <4aptvk$q7b@newsbf02.news.aol.com>
Path: arc1-ca.pugleaf.net!newsbf02.news.aol.com!not-for-mail
References: <1995Dec14.120627.31590@ucl.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!newsbf02.news.aol.com!not-for-mail
From: mwron@aol.com (MW Ron)
Newsgroups: comp.sys.mac.programmer.codewarrior,comp.lang.c++
Subject: Re: ANSI standards
Date: 14 Dec 1995 14:29:56 -0500
Organization: America Online, Inc. (1-800-827-6364)
Sender: root@newsbf02.news.aol.com
Message-ID: <4aptvk$q7b@newsbf02.news.aol.com>
References: <1995Dec14.120627.31590@ucl.ac.uk>
Reply-To: mwron@aol.com (MW Ron)
NNTP-Posting-Host: newsbf02.mail.aol.com