home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20075 < prev    next >
Encoding:
Internet Message Format  |  1993-01-22  |  1.6 KB

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