>At least for C, what makes the compiler (relatively) inefficient is that>the functions are compiled independently. It forbids register allocation>across function calls. It constrains the compiler to make pessimistic>assumptions on the register usage by the called functions.

Prototype declarations were included in ANSI C partly with the idea of
allowing parameter passing through registers, at least for functions with
a fixed number of arguments. To quote from p42 of the Rationale
accompanying X3.159-1989 which isn't part of the standard proper but does
provide interesting background:

"This provision constrains the latitude of an implementor because the
parameter passing conventions of a prototype and non-prototype function
calls must be the same for functions accepting a fixed number of
arguments. Implementations in environments where efficient function
calling mechanisms are available must, in effect, use the efficient
calling sequence either in all "fixed argument list" calls or in none.
Since efficient calling sequences often do not allow for variable argument
functions, the fixed part of a variable argument list may be passed in a
completely different fashion than in a fixed argument list with the same
number and type of arguments."

I agree that register passing is an effective optimization but one of the
major problems with C is handling pointers, or more particularly
determining which pointer operations have side-effects on other variables.

cheers,
Danny Thomas
[P.J. Plauger has told me that during most of the standardization discussions,
prototyped and non-prototyped functions weren't supposed to be interchangable.
I don't know when that changed. -John]
--