home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!utcsri!utgpu!attcan!telly!druid!darcy
- From: darcy@druid.uucp (D'Arcy J.M. Cain)
- Newsgroups: comp.lang.c
- Subject: Re: should main be prototyped?
- Message-ID: <1993Jan22.123750.3141@druid.uucp>
- Date: 22 Jan 93 12:37:50 GMT
- References: <1993Jan14.172445.23622@taumet.com> <1993Jan18.132735.16197@druid.uucp> <1993Jan19.163127.4231@taumet.com>
- Organization: D'Arcy Cain Consulting
- Lines: 24
-
- steve@taumet.com (Steve Clamage) writes:
- >darcy@druid.uucp (D'Arcy J.M. Cain) writes:
- >> int main(void); /* prototype main - 1/2 :-) */
- >> int main(void)
- >> {
- >The prototype declaration for main() in your example has no effect
- >whatever. If you place a prototype declaration at the top of a file
- >or in a header, it allows a function to call the prototyped function
- >from a point where the function definition is not visible. Placing
- >the prototype declaration on the line immediately before the function
- >definition is pointless, IMHO, and not a justifiable programming practice.
-
- You're right. The only reason I do it is to keep Gnu quiet when I use
- the -Wmissing-prototypes. It would be nice if Gnu recognized that main()
- was a special case and didn't issue the warning for that case or better
- yet checked that the definition of main followed one of the two possible
- forms form main. Preventing one warning in an otherwise warning free
- compile is the justification in my case.
-
- --
- D'Arcy J.M. Cain (darcy@druid.com) |
- D'Arcy Cain Consulting | There's no government
- Toronto, Ontario, Canada | like no government!
- +1 416 424 2871 DoD#0082 |
-