Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It depends on the calling convention used -- whether it is caller clean-up or callee clean-up. With caller clean-up, the stack pointer is left below the argument list when the function returns. With callee clean-up, it gets popped above the argument list. You can perform tail calls naturally if it's callee clean-up. (With caller clean-up, a compiler might hypothetically pull off a tail call if the callee's argument list takes less memory, but it's not something you could add as a language feature.)


Thanks, that explains the trouble I was having. I was thinking about it without any consideration to calling-convention.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: