entry at other than main (was want to know)

Raymond Dunn ray at philmtl.philips.ca
Tue Aug 22 06:19:13 AEST 1989


In article <19164 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
 >In many articles many people write this, that, and the other argument
 >for or against `main()' as the program entry point.
 >
 >Personally, I do not see this as much of an issue.

Neither do I, however:

 >Anyway, this gives us some background with which to consider the
 >options available.  We have four standard approaches available:
 >	a) program begins at procedure or function declared with
 >	   some special syntax;
 >	b) program begins at top;
 >	c) program begins at reserved name (`main');
 >	d) program begins at any function (Lisp, APL, etc).

A fifth approach in use that Chris seems to have missed:

	e) program begins at the external symbol specified at link time.

Thus part of the "ideal" approach that Chris suggests is already prior art:

 >  We could allow programs to declare each entry point with a
 >`program' or `entry' statement, and thus share subroutines and get the
 >effect of switching on argv[0] on Unix machines, as ex/vi/view/edit/e
 >and compress/uncompress do.  To do this we must have the compiler and
 >the linker cooperate...

There is no doubt that this is a cheap elegant "best" solution.

The fact that 'C' doesn't have it is only marginally a problem at worst.

-- 
Ray Dunn.                    | UUCP: ..!uunet!philmtl!ray
Philips Electronics Ltd.     | TEL : (514) 744-8200  Ext: 2347
600 Dr Frederik Philips Blvd | FAX : (514) 744-6455
St Laurent. Quebec.  H4M 2S9 | TLX : 05-824090



More information about the Comp.lang.c mailing list