I have a simple question. I know that after compile a program when I call a function a call stack is generated with the arguments, space for local vars, return point and the registers that i’m charged.
But in object-oriented language like c++, where the compiler stores the reference to the current object? object->instanceMethod() will store the object pointer like an argument in the call stack?
I know the question is generalist and thanks for the answer
In C++, when a member function is called the pointer to the instance on which it will operate (i.e. what will be
thisinside the function) is implicitly passed alongside the other function arguments/parameters. Actually, different systems use different conventions, so some number of such parameters could be packed into registers and never placed on the stack (this tends to be faster), but your conception is basically sound.