Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
Eventually the return value ends up somewhere where it actually has meaning, and if used there then that part is incorrect. Granted, it could be advisable to avoid returning a very large string or an object with side-effects at destruct or something like that. But I don't consider it any more correct to return a zero than some other value when there should be no return value at all; it's garbage no matter what it is.
Technically you're right. But since the performance hit is rather small, I'd say it's bad practice to leave anything other than zero on the stack in case of a void function returning. Actually, apply could probably check that the function is a void function and force the zero on the stack.
(The core problem is that the calling convention is bogus at the C level. Every function ought to return an integer saying how many values it left on the stack, zero or more. That'd allow implementing multiple return values.)
Why not change this (for 7.9) to avoid all this sillyness and indeed support multiple return values?