home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / programm / 2417 < prev    next >
Encoding:
Text File  |  1992-08-21  |  2.0 KB  |  44 lines

  1. Newsgroups: comp.programming
  2. Path: sparky!uunet!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watserv1!mhcoffin
  3. From: mhcoffin@tolstoy.uwaterloo.ca (Michael Coffin)
  4. Subject: Re: ANSI C, was Re: Teaching the basics
  5. In-Reply-To: nickel@cs.tu-berlin.de's message of Thu, 20 Aug 1992 23:07:25 GMT
  6. Message-ID: <MHCOFFIN.92Aug21081457@tolstoy.uwaterloo.ca>
  7. Sender: news@watserv1.uwaterloo.ca
  8. Organization: Dept. of Computer Science, University of Waterloo
  9. References: <Bt6DGq.HuB@metropolis.com> <12635@anderson>
  10.     <ratner.714247759@ficus.cs.ucla.edu> <13226@bnr-rsc.UUCP>
  11.     <MHCOFFIN.92Aug20162507@tolstoy.uwaterloo.ca>
  12.     <NICKEL.92Aug21010722@desaster.cs.tu-berlin.de>
  13. Date: Fri, 21 Aug 1992 13:14:57 GMT
  14. Lines: 28
  15.  
  16. In article <NICKEL.92Aug21010722@desaster.cs.tu-berlin.de> nickel@cs.tu-berlin.de (Juergen Nickelsen) writes:
  17. > In article <MHCOFFIN.92Aug20162507@tolstoy.uwaterloo.ca>
  18. > mhcoffin@tolstoy.uwaterloo.ca (Michael Coffin) writes:
  19. > > It is true that if you use a certain amount of discipline and make
  20. > > sure that the same prototype appears in both places---by putting it in
  21. > > an include file---the compiler will detect the error.  The problem is,
  22. > > there isn't any enforcement of this policy.
  23. > This is indeed a weakness of the standard, but at least gcc can be
  24. > told to issue a warning when a function call without a previous
  25. > prototype is encountered. From the manual:
  26. >     `-Wmissing-prototypes'
  27. >      Warn if a global function is defined without a previous prototype
  28. >      declaration.  This warning is issued even if the definition itself
  29. >      provides a prototype.  The aim is to detect global functions that
  30. >      fail to be declared in header files.
  31. > But using this is a major pain on a system without ANSI Header files.
  32.  
  33. And there is no guarantee that the prototype "seen by" the global
  34. definition is the same prototype that is seen by uses of that
  35. function.  It's up to the programmer to make sure the prototype gets
  36. put in an include file and included in both places.
  37.  
  38. -mike
  39.