want to know

Jeffrey Kegler jeffrey at algor2.algorists.com
Tue Aug 29 06:25:51 AEST 1989


In article <10781 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
>I've never felt the need to "program around" C's use
>of main() as the entry point for (hosted) programs.

I have, occasionally.  Consider a directory (bigapp.d) containing a
large applications (bigapp), where you want you have some smaller
associated utilities (ut1, ut2, ...) which use routines in bigapp.  It
does not always make sense to group the routines shared by the large
application with one or more of the utilities into a library in a
separate directory.

Now bigapp.c, ut1.c, ut2.c, etc., each must have a main().  This is
annoying for use with debuggers, cross-referencers, etc.  In the above
situation it makes a lot of sense to have each routine in bigapp.d
named differently.  It would be nice for the entry point for the ut1,
ut2, ... executables to be named ut1(), ut2(), etc.  The entry point
in bigapp.c could be called main() or bigapp() depending on taste.
-- 

Jeffrey Kegler, Independent UNIX Consultant, Algorists, Inc.
jeffrey at algor2.ALGORISTS.COM or uunet!algor2!jeffrey
1762 Wainwright DR, Reston VA 22090



More information about the Comp.lang.c mailing list