Xref: utzoo comp.lang.c:40275 comp.lang.c++:14261 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!elroy.jpl.nasa.gov!lll-winken!iggy.GW.Vitalink.COM!widener!netnews.upenn.edu!msuinfo!buster.cps.msu.edu!draper From: draper@buster.cps.msu.edu (Patrick J Draper) Newsgroups: comp.lang.c,comp.lang.c++ Subject: Prototypes local or global opinions wanted Message-ID: <1991Jun20.202241.7531@msuinfo.cl.msu.edu> Date: 20 Jun 91 20:22:41 GMT Sender: news@msuinfo.cl.msu.edu Reply-To: draper@buster.cps.msu.edu (Patrick J Draper) Organization: Dept. of Computer Science, Michigan State University Lines: 43 Originator: draper@buster.cps.msu.edu I'm interested in what others think of the practice of declaring function prototypes locally within a procedure. local: foo () { int bar (void); int x; x = bar (); } -------------------------------------------------------------------- global: int bar (void); foo () { int x; x = bar (); } The advantage to the local declaration that I can see is that an unintentional call to bar() will be flagged by the compiler. I prefer to use the global declaration because if the definition of bar should change, there's one place to change the prototype. Any other opinions? Thanks, ------------------------------------------------------------------------ Patrick Draper "College is supposed to prepare you for the future, cps.msu.edu but all my future's behind me." draper@cps.msu.edu -- My GrandPa, age 85, Fall 1990 graduate of Western Michigan University ------------------------------------------------------------------------