Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
Well, if the function is declared to return void, then most likely the garbage return value will be popped shortly afterwards. It's only in cases like hilfe, which always print out the return value even from void functions, that you get to see the last argument or something as the return value (there are many void functions like that). I don't think it's worth the effort to push a zero for that case.
I thought so too, then I looked at my PIKEFUN void decodedatarow(int msglen) and already altered the code deliberately *not* to clean up the stack (it ends up with an array and two objects on the stack) and let apply() clean it up.
Then I realised that if anyone (in the future) happens to muck around with the topvalue after the void function has returned (the object), rather unforeseen bugs will crop up. So I clean up the stack anyway to go for the element of least surprise (I let apply() push the zero though, not going to bother with that).
I presume that actually pushing a zero only entails filling struct svalue with some fixed values and increasing the stackpointer? (i.e. a minor performance hit).