c - Machine level memory theory -
i have question homework, , love if give me answer, more importantly if explain me in details happening @ machine level.
choose platform want , describe happens @ machine level in execution of code below when func() called.
what changes if foo inlined?
int foo( int a, int* b) { return + *b; } extern int x; void func() { int y = 7; int r; r = foo( x, &y ); printf("%d\n", r); }
assuming no optimization occurring, basic difference between function call , inline call there no functional scope added. function call, function scope pushed on program stack , used accommodate local variables function, etc. upon return, stuff popped off stack.
with inline function, code pasted current routine, nothing pushed on stack. 1 can see simple routines, can beneficial. inline routine sort of (conceptually) halfway between function , macro in c parlance.
Comments
Post a Comment