want to know

Cesar Quiroz quiroz at cs.rochester.edu
Thu Aug 17 06:32:19 AEST 1989


Just a few difficulties I have with Badger's argument.

In <2538 at trantor.harris-atd.com>, bbadger at x102c.harris-atd.com wrote:
| ...
| 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.

Not quite so.  I bet all the C code I keep has different names for
different programs.  I just happen to use the filename to name the
programs.  The particular entry point used by the runtime system is
of no importance when looking for informative naming, because that
name is not the one people associate with the program!  The
objection is trivially true, and quite irrelevant.  [I wouldn't
claim the scheme in use is perfect, think about how many times a
novice writes a `test.c' and gets himself into strange states.]

| 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.

This is true, and also irrelevant.  It is not unusual to have a
`usage()' function, just because it is the reasonable thing to do.
Do you also special-case this?  This point only says that the tools
need a correct model of the naming system, rather than build in
erroneous assumptions (``No two programs have different functions
with the same name'').

| Secondly, I don't really like the idea of having a _single_ entry
| point to a program.  ...

This is more interesting.  Is it fair to say that this issue goes
beyond the language itself and into the design of the programming
environment? If you could suppress the hand-waving and provide more
detail about how you would go about changing exec and the shells it
would be a stronger proposal.  As it is, it amounts to `I don't like
it, I like X and you take care to make sure X works for me', a
position for which I have no sympathy.

If anyone cares to formulate this proposal in terms that can be
discussed, I would suggest taking a look at the debate (in the Lisp
community) between residential and file-based systems, just to make
sure no time is spent in rediscoveries.  My impression is that the
new language created that way will have little resemblance to C
anyway.

-- 
                                      Cesar Augusto Quiroz Gonzalez
                                      Department of Computer Science
                                      University of Rochester
                                      Rochester,  NY 14627



More information about the Comp.lang.c mailing list