want to know

Bill Svirsky svirsky at ttidca.TTI.COM
Fri Aug 18 03:08:34 AEST 1989


In article <2538 at trantor.harris-atd.com> bbadger at x102c.harris-atd.com writes:
+In article <1701 at crdgw1.crd.ge.com> davidsen at 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 at ttidca.tti.com | ...!{csun,psivax,rdlvax,retix}!ttidca!svirsky



More information about the Comp.lang.c mailing list