+1 vote
1.8k views
Can anybody explain me access link and control link in activation record?I am confused what is different between them

IF POSSIBLE GIVE EXAMPLE ALSO

THANKS A LOT
| 1.8k views
+4
control link is used to return back to the scope of caller function..

access link is used to access data from the scope where the function(the function whose activation record is currently processed) is defined..
0
Please can u explain by an example :)

THANKS
+1

@Himanshu Goyal,

main() {
int x, y;
#Calling a function
fun();
}

fun() {
#Function called from main()
return;
}

During the function call fun(), if the function wants to access the variables x, y (statically scoped) of it's calling function i.e main(), it makes the use of access link.

Now when this function fun() terminates/returns, it's activation record is popped from the stack and the control is given back to the main() function. This is done using the control link.

Please correct me if I'm wrong anywhere.

0

@Akash Mishra Your first line is completely wrong.

Access link is defined for the static and not dynamic.

0

@`JEET, yes, thank you. I'll correct it.

+1 vote

control link from record A points to the previous record on the stack. The chain of control links traces the dynamic execution of the program.

An access link from record A points to the record of the closest enclosing block in the program. The chain of access links traces the static structure (think: scopes) of the program.

by

+1 vote