C function prototyping and large projects

jim nutt jim.nutt at p11.f15.n114.z1.fidonet.org
Tue Oct 4 19:14:18 AEST 1988


 > From: cramer at optilink.UUCP (Clayton Cramer)
 > Message-ID: <534 at optilink.UUCP>
 > In article <8597 at smoke.ARPA>, gwyn at smoke.ARPA (Doug Gwyn ) writes:
 > > In article <435 at thirdi.UUCP> peter at thirdi.UUCP (Peter Rowell) writes:
 > > >Minor Flame:  I do *not* understand why people seem to feel that there
 > > >is some moral benefit to manual maintenance of information that is
 > > >trivially kept correct by automatic means.  If it is OK for the 
 > compiler
 > > >to "automatically" check these things, what is wrong with creating 
 > them
 > > >automatically?
 > > 
 > > In the specific case of function prototypes, if you are following
 > > recommended software engineering procedure, your specification for
 > > function interfaces precedes writing the code to implement (or use)
 > > them.  Automatic generation of prototypes goes in exactly the wrong
 > > direction.
 > 
 > Amazing, though, how often the function interfaces change after you
 > start debugging -- and how easy it is to forget to add new function
 > prototypes when you add new functions.
 > 
 > The compiler will catch the mismatches of prototypes when you change
 > an existing function specification, but it's still darn annoying to
 > realize you need to make the change after 20 modules have recompiled,
 > and you have to recompile them again.
 > 
 > It's a bit of a nuisance setting up the make files to do it (at least
 > with Microsoft C), but automatic generation of function prototypes
 > is the only way to go.

there is a better way to do it if you have a decent editor...  simply write a 'prototype macro'.  then use the newstyle function declarations (if you can).  all the prototype macro has to do is copy the function declaration to either a header or to the top of the file and add a semicolon to the end.  instant prototype.  better yet, just get into the habit of doing it yourself automatically.

jim nutt
'the computer handyman'


--  
St. Joseph's Hospital/Medical Center - Usenet <=> FidoNet Gateway
Uucp: ...{gatech,ames,rutgers}!ncar!noao!asuvax!stjhmc!15.11!jim.nutt



More information about the Comp.lang.c mailing list