want to know

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Aug 18 07:00:41 AEST 1989


In article <2549 at trantor.harris-atd.com> bbadger at x102c.harris-atd.com (Badger BA 64810) writes:
>You use significant names for the files of your programs, why shouldn't you 
>use significant names for the main routines?

main() certainly is a descriptive name for the role of that pseudo-function
within a C application.  The application within its invocation context has
yet another, hopefully descriptive, name ("grep"?) or icon (smiling frog?)
or whatever.

>There really wouldn't be any much change to C.  Even now, main() isn't
>treated specially by the C compiler.

Speak for yourself.  The C compiler I use at home processes the main()
pseudo-function differently from other functions, and in general any
Standard-conforming implementation is going to have to give some degree
of special treatment to main(), since it doesn't follow quite the same
rules as normal C functions.

The question has come up, can the main() function be invoked as a normal
C function (i.e. recursively by the application).  I think it is not
guaranteed by the Standard; others think it is.  This would be a good
thing for X3J11 to address in the "interpretations" phase.



More information about the Comp.lang.c mailing list