Follow up to How Do I Prototype this?

Dave Eisen dkeisen at Gang-of-Four.Stanford.EDU
Wed Jul 4 12:07:38 AEST 1990


In article <300 at taumet.com> steve at taumet.UUCP (Stephen Clamage) writes:
>
>How does one write a function which might or might not have a first
>argument of any type?  However you do it, I suspect the program
>would be very difficult to understand and maintain.  Some re-thinking
>of the program design would be in order.
>-- 


The behavior of the function can be determined by the value of a global
variable. 

The database package we use does something like this --- most of the database 
access functions take an optional database number which is needed only if you 
have opened more than one database and have not called 
d_setdb (int database_number) which tells the database library to
use the given database_number for all future database access functions. The
database library knows if this is the case by checking values in db_global,
a global variable that stores all of the global database information.

I don't agree with this design decision, but it isn't horrible either.




--
Dave Eisen                      	    Home: (415) 323-9757
dkeisen at Gang-of-Four.Stanford.EDU           Office: (415) 967-5644
1447 N. Shoreline Blvd.
Mountain View, CA 94043



More information about the Comp.lang.c mailing list