Consider an OS that can launch an executable, only
communicates through a stack, and expects each executable
it launches to push a value onto the stack.
If the OS launches a badly behaved executable that does
not push a value onto the stack things can break.
Gee thanks for explaining to me, what I've explained already to you
Monkey in the deep green jungle see, monkey in de jungle do
I seem to be dealing with Fred Flintstone or Barney Rubble
Fire burn and caldron bubble
Betty and Wilma singing yabba dabba doo.
[Note the OS can make things a lot more robust, by
pushing a sentinel value, e.g. 169, onto the stack,
always use to top value as the return value
and pop twice on return iff the top value is not
the sentinel value. Now things only break
if the executable pushes more than one value
or returns the sentinel value, and maybe not even then.]
Doesn't really close the leak, does it. Kind of like my field repair
to my shower until I can get the super to fix it, because you're
exposed to some clown stacking the sentinel. I already explained a
better way that STILL won't work: save the size of the stack before
calling the executable...in a local variable...oops...as Schildt would
know (what with that MSCS and shit) and Seebach wouldn't, that would
be on the...stack...dang.
Ooooohhhh how about putting it on the C drive...get a life...what eeef
you doan't got no steeenking deesk drive.
Ooooh I got it...the Windows Registry...yeah right...
In the general scientific sense, you're fucked. Basically, C
programmers out of vanity feel that they're like the Blues Brothers,
onna mission from God, and need to communicate with shell procedures
important stuff, like hey, I finished. The decision to define the
interface rigidly for "hosted" environments was the best one. But it
does NOT entail that void main() is "nonstandard C".
What should a C implementation faced with void main()
do.
-it could refuse to produce an executable.
Good idea. General Strike!
-it could produce a badly behaved executable
-it could produce a well behaved executable,
(maybe by wrapping main by bados_main, which
always returns a value, the value provided by
main() if it exists, otherwise 0. Note bados_main
may have to use implementation magic to determine
the return type of main)
Hmm, that was my idea, wasn't it. God I love this zoo.
I don't see the failure of the C standard to mandate the
third behaviour as a "deficiency".
Of course you don't.