Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!purdue!gatech!bbn!ishmael!inmet!pcasey From: pcasey@inmet Newsgroups: comp.lang.c Subject: Re: entry at other than main (was w Message-ID: <20900003@inmet> Date: 22 Aug 89 20:38:00 GMT References: <657@philmtl.philips.ca> Lines: 41 Nf-ID: #R:philmtl.philips.ca:-65700:inmet:20900003:000:1686 Nf-From: inmet!pcasey Aug 22 16:38:00 1989 /* Written 4:19 pm Aug 21, 1989 by ray@philmtl.UUCP in inmet:comp.lang.c */ /* ---------- "Re: entry at other than main (was w" ---------- */ In article <19164@mimsy.UUCP> chris@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 /* End of text from inmet:comp.lang.c */