void main() (second proof of non-portability)

Will Crowder will at charyb.COM
Sat Nov 18 05:54:45 AEST 1989


In article <1018.25642ba8 at csc.anu.oz> bdm659 at csc.anu.oz writes:

[lots of stuff about void main() unportability having to do with passing
 return values on the stack]

I've used a 6 or so C compilers in 3 very different environments,
(680x0, 80x86, SPARC), and all of them pass return values in registers.

The question I have is this: for every C compiler I've used, it doesn't
matter how many arguments you call a function with.  The return linkage
will still work, because it's the *caller's* job to fix up the stack
after the function returns.  Are there any implementations in which this
is not true?  Can someone point me to a C compiler which does use a vastly
different calling convention?  I'm just curious.  Passing return values
on the stack doesn't seem like a very good performance move, and most
machines have at least one register to pass something in...If the caller
needs the contents of that register saved, it can save it itself before
calling the function...again, stack frame integrity is the caller's
responsibility in C (or at least any sane implementation), no?

Will



More information about the Comp.lang.c mailing list