Article View: comp.sys.mac.programmer.codewarrior
Article #21Re: ANSI standards
From: williamt
Date: Mon, 18 Dec 1995 03:16
Date: Mon, 18 Dec 1995 03:16
21 lines
1240 bytes
1240 bytes
hammond_g@drkclu.meng.ucl.ac.uk (G. Ruth Hammond) wrote:
>
>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. ...
>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?)
I don't recall what the ANSI standard is, I'd suspect void main(void);...
All Metrowerks compilers declare __MWERKS__ so you could #ifdef on that:
#ifdef __MWERKS__
void main(void)
#else
int main(void)
#endif
{
... /* main stuff */
}
Technical Details
Message-ID:
<4b2me3$a8c@news.aloha.com>Path:
arc1-ca.pugleaf.net!in1.uu.net!coconut!usenetReferences:
<1995Dec14.120627.31590@ucl.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in1.uu.net!coconut!usenet From: <williamt@aloha.com> Newsgroups: comp.sys.mac.programmer.codewarrior,comp.lang.c++ Subject: Re: ANSI standards Date: 18 Dec 1995 03:16:19 GMT Organization: FlexNet Inc, HAWAII Message-ID: <4b2me3$a8c@news.aloha.com> References: <1995Dec14.120627.31590@ucl.ac.uk> NNTP-Posting-Host: dialup35.aloha.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 1.12(Macintosh; I; PPC) To: hammond_g@drkclu.meng.ucl.ac.uk X-URL: news:1995Dec14.120627.31590@ucl.ac.uk