home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 33,111 of 33,346   
   Thomas Richter to All   
   Re: overlapping of function stack frames   
   29 Jun 13 01:12:03   
   
   From: thor@math.tu-berlin.de   
      
   Hello,   
      
   > 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.   
   >   
   > Is that ever allowed to be done by a C++ compiler, I think maybe in   
   > case of following function(assuming it's not inlined and only   
   > variables in scopes of its callers are passed to it)?   
      
   The C++ standard does not even say how parameters are passed in and   
   out of subroutines, so I see no reason why this should not be   
   allowed. C++ does not even use the word "stack". Actually, nothing   
   requires parameters to be passed on the stack. For example, the SPARC   
   architecture has register windows to do that, plus a window manager   
   that might flush out occupied registers to the stack if required.   
      
   Greetings,	   
   	Thomas   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca