0

Hello
I encountered following info at this page:

For some purposes, the stack frame of a subroutine and that of its caller can be considered to overlap, the overlap consisting of the area where the parameters are passed from the caller to the callee. In some environments, the caller pushes each argument onto the stack, thus extending its stack frame, then invokes the callee. In other environments, the caller has a preallocated area at the top of its stack frame to hold the arguments it supplies to other subroutines it calls. This area is sometimes termed the outgoing arguments area or callout area. Under this approach, the size of the area is calculated by the compiler to be the largest needed by any called subroutine.

So may a C++ compiler do such thing in case of following function (assuming it's not inline of course and only variables in local scopes of callers of this function are passed as arguments to this function) or any function at all?

void foo(int & ref){ref++;}
2
Contributors
1
Reply
18
Views
4 Years
Discussion Span
Last Post by sepp2k
0

The compiler may handle function arguments either of the ways described in the article no matter what the called function looks like.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.