Article View: alt.msdos.programmer
Article #1162Re: Pascal program works but not C program!
From: Peter Seebach
Date: Mon, 08 Jan 1996 01:09
Date: Mon, 08 Jan 1996 01:09
74 lines
2942 bytes
2942 bytes
In article <4cp3vc$8nh@brahms.tfi.be>, Tasmaniac <Tasmaniac@unicall.be> wrote: >>> void main(int argc,char *argv[]) >> ^-----------------------------This one too, but not too serious >why is this a problem ? Because it conflicts with the ANSI/ISO standard for C. (ANSI/ISO 9899-1990) >It's 100% legal to declare main as any of the following Really? Wanna bet? How much? >void main (void) Nope. >int main (void) Yup. >void main (int argc, char *argv[]) Nope. >int main (int argc, char *argv[]) Yup. >void main (int argc, char **argv) Yup. >int main (int argc, char **argv) Yup. >void main (int argc, char *argv[], char *envp[]) Nope. >int main (int argc, char *argv[], char *envp[]) Nope. >void main (int argc, char *argv[], char **envp) Nope. >int main (int argc, char *argv[], char **envp) Nope. >void main (int argc, char **argv, char *envp[]) Nope. >int main (int argc, char **argv, char *envp[]) Nope. >void main (int argc, char **argv, char **envp) Nope. >int main (int argc, char **argv, char **envp) Nope. >erhm.. that should be it, I may have missed one... You missed quite a lot. Hint: Don't post when you don't have a fucking clue. I can understand being incorrect. I cannot understand, or tolerate, the idiocy of posting such a long "correction" when it is devoid of accuracy or content. What, precisely, gives you these ideas? What authority, great one, shall we turn to that overrides or supersedes the ANSI and ISO standards committees? Do you have a platinum-iridium compiler we should know about? ANSI/ISO C *requires* one of two declarations of main in a hosted environment. (In a freestanding environment, it is implementation defined whether or not there may be, must be, or is, a function named main.) They both return int. One has no arguments, the other has two. Please read the FAQ, which describes this, and take the time to learn the material it covers, at least, and also that covered by any decent C text, *before* posting such garbage as "answers". If you got this incorrect understanding from a book, get a better book. There are plenty. -s -- Peter Seebach - seebs@solon.com - Copyright 1995 Peter Seebach. C/Unix proto-wizard -- C/Unix questions? Send mail for help. No, really! Using trn? Weird new newsgroup problem? I know the fix! Email me! The *other* C FAQ - ftp taniemarie.solon.com /pub/c/afq - Not A Flying Toy
Technical Details
Message-ID:
<4cpqt6$9r8@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4cdpr2$psi@lugb.latrobe.edu.au> <Pine.SV4.3.91-heb-2.04.960104114930.16292A-100000@cs.technion.ac.il> <4cp3vc$8nh@brahms.tfi.be>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: seebs@solutions.solon.com (Peter Seebach) Newsgroups: alt.msdos.programmer,comp.lang.c Subject: Re: Pascal program works but not C program! Date: 7 Jan 1996 19:09:58 -0600 Organization: Usenet Fact Police (Undercover) Message-ID: <4cpqt6$9r8@solutions.solon.com> References: <4cdpr2$psi@lugb.latrobe.edu.au> <Pine.SV4.3.91-heb-2.04.960104114930.16292A-100000@cs.technion.ac.il> <4cp3vc$8nh@brahms.tfi.be> NNTP-Posting-Host: solutions.solon.com