(* func)(fred, bert)

Dr. T. Andrews tanner at cdis-1.uucp
Thu Nov 16 02:17:15 AEST 1989


In article <11592 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
) [ included text on declaring "main" to be "void" instead of "int"
)   for main which does not return ]
) One of them is that its type is int()(int,char**) ... start-up
) module, in environments that use one, is invoking main()
) as a function that WILL return an integer value.  If you ... define
) it properly but fail to arrange for an integer to be returned,
) the startup module can get confused or simply die when the improper
) return linkage is executed.
It was noted that no return linkage is executed, account of call to
exit(2) or local equiv.

) However, your code is not portable.
I should like to hear details of a case where the code will not
work.  It seems ridiculous to declare un-portable the results of a
void-vs-int return linkage which is never made, and I should like
to hear of an implementation where this actually fails.

If no real-world example is available, I should be almost as
satisfied with a conjectural example (clearly marked as conjecture).
Such should prove enlightening not only to earlier posters, but
to me as well.  A day spent without learning SOMETHING is a poor
day indeed.

It seems odd that X3J11 or its members would come up with such claims
about main().  It would seem to fly in the face of years of established
practice of using exit(condition) as a way to terminate programs.
Declaring such programs non-portable does not seem to me to be a
productive use of X3J11's time; obviously, I can use a little bit of
education from someone who knows better than myself.
-- 
Mulroney: "Cut trains.  Drive in | {bpa,uunet}!cdin-1!cdis-1!tanner
Canada.  We need the acid rain." | {attctc gatech!uflorida}!ki4pv!cdis-1!tanner



More information about the Comp.lang.c mailing list