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