Path: utzoo!utgpu!water!watmath!clyde!att!rutgers!mailrus!ncar!noao!asuvax!stjhmc!p6.f18.n114.z1.fidonet.org!will.summers From: will.summers@p6.f18.n114.z1.fidonet.org (will summers) Newsgroups: comp.lang.c Subject: Re: C function prototyping and large projects Message-ID: <725.233C2009@stjhmc.fidonet.org> Date: 23 Sep 88 02:09:55 GMT Sender: ufgate@stjhmc.fidonet.org (newsout1.24) Organization: FidoNet node 1:114/18.6 - Iasd Eng Bbs, Phoenix Az Lines: 42 In article <1281@micomvax.UUCP> ray@micomvax.UUCP (Ray Dunn) writes: RD> Continually re-generating prototypes can only lead to trouble, does not RD> adequately separate "static" and "extern" declarations, and doesn't RD> automatically get the information into the correct places. Segrating statics is not a problem as long as the generator makes a distinction between these (either has an option to only generate for "extern"s or carries the distinction to the output). What other "trouble" can it lead to? RD> Define things as global only on a "Need to know" basis - i.e. put static RD> in front of everything in sight! (:-)/2 Hear Hear!! RD> Hopefully prototyping will increase the diligence of using that little RD> word "static" when defining procedures which do not *need* to be global Many will sneer, but my local "universal" include contains: #define public /* nothing */ #define private static 'static' only gets used for storage duration, 'private' for linkage. Consistently using 'public' serves 3 purposes: 1> It makes it easier for automatic header generators to find the publics. 2> It removes the temptation to take the shortcut of leaving the linkage unspecified when the function really should be 'private'. In other words it forces a decision to be made and puts the public and private choice on even footing... 3> Closely related to <2>, it informs the reader that I -choose- to make the function/variable public and it is in fact used in other files (ie. check other files before mucking with it). \/\/ill-- St. Joseph's Hospital/Medical Center - Usenet <=> FidoNet Gateway Uucp: ...{gatech,ames,rutgers}!ncar!noao!asuvax!stjhmc!18.6!will.summers