Static and dynamic parent function

I read thoughts in C ++ (volume 2):

Whenever a function is called, information about this function is pushed onto the run-time stack in an instance of an activation record (ARI), also called a stack frame. A typical stack frame contains (1) the address of the calling function (therefore, execution can return to it), (2) a pointer to the ORI of the static parent function (which lexically contains the called function, so global variables can be accessed by the function), and (3) a pointer to the function that he called (his dynamic parent). A path that follows logically from a dynamic chain or call chain repeated after dynamic parent relationships

I cannot understand what the author means as a function of static and dynamic parent. Also, I cannot distinguish between objects 1, 2, or 3. They all seem the same. Can someone explain this passage to me?

+3
source share
2 answers

All this sounds very strange to me. Static frame pointers are commonly used in lexical-spoken languages ​​such as functional languages ​​and the pascal family with their nested functions. Globals are bound once at compile time or run time and do not need frame pointers. (1) but (2) does not exist in C ++, AFAIK.

, (3) . , , .

+2

, ++, . 1) - - call . , pop ed , ( ++) 2) 3) , . (, ), , ( ) , ,

+4

Source: https://habr.com/ru/post/1738656/


All Articles