I'm working on a tutorial on "vertex buffer objects" in GL. At the beginning, I try to explain why this method has obsoleted an older one (which uses way more function calls) and said, thoughtlessly:
I submitted this for peer review and someone responded:As we know, every function call in C/C++ requires a stack be created, then freed at the end.
Thinking about this, I suppose all functions already have a stack at runtime, so it is just a matter of setting the ebp (?? or whatever) to it and copying in some values -- the memory is already allocated. Do I have this straight now?To the best of my knowledge this isn't true. A stack frame (not stack) needs to be setup but, generally, memory allocation does not occur. It really just copies some values and moves a pointer by an offset. Function call overhead can still be an issue though.
BUT, I still need to say something informative (and accurate) about exactly how "Function call overhead can still be an issue". I suppose this overhead is just the copying of values and not allocation of memory?