Path: utzoo!attcan!uunet!philmtl!philabs!ttidca!svirsky From: svirsky@ttidca.TTI.COM (Bill Svirsky) Newsgroups: comp.lang.c Subject: Re: want to know Message-ID: <5446@ttidca.TTI.COM> Date: 17 Aug 89 17:08:34 GMT References: <8487@bsu-cs.bsu.edu> <2980@solo9.cs.vu.nl> <182@sunquest.UUCP> <14269@haddock.ima.isc.com> <1496@l.cc.purdue.edu> <1701@crdgw1.crd.ge.com> <2538@trantor.harris-atd.com> Reply-To: svirsky@ttidcc.tti.com (Bill Svirsky) Organization: Citicorp/TTI, Santa Monica Lines: 38 In article <2538@trantor.harris-atd.com> bbadger@x102c.harris-atd.com writes: +In article <1701@crdgw1.crd.ge.com> davidsen@crdos1.UUCP (bill davidsen) writes: +> If you really want to have a program which enters somehere else write +>a dummy main: +> main(argc, argv, env) +> int argc; +> char *argv, *env; +> { exit(yourname(argc, argv, env)); } +> +I have problems with ``main'' from two different directions. + +Firstly, it is less informative to the user. Having a fixed entry like main +removes the possibility of a descriptive name being applied to a program. +It also interferes with naming conventions for files and cross-reference tools +like ctags. Our local ctags has been modified to substitute ``Mfoo'' for +the symbol ``main()'' found in file ``foo.c''. This kind of game wouldn't +be required if C let you choose your main program name. Any reason why the following wouldn't work? #define InformativeName main ... InformativeName(argc, argv) int argc; char *argv[]; When working with someone else's code for the first time, I like being able to find where the program starts by doing a global search for "main", since many programmers don't put it at the beginning of the source. Or, if there are many modules, and none with a name that gives a clue of which is the main module, I can do an fgrep on main. Not all the source I get has good, or even any, documentation. -- Bill Svirsky, Citicorp+TTI, 3100 Ocean Park Blvd., Santa Monica, CA 90405 Work phone: 213-450-9111 x2597 svirsky@ttidca.tti.com | ...!{csun,psivax,rdlvax,retix}!ttidca!svirsky