Params Flashcards
r-value
value of an expression
l-value
location or address of expression
Parameter passed by value
calling method copies the r-value of the arg into the called method’s AR
Value result param passing
value of the param is copied into called AR but when method ends, final values copied back into args
When can aliasing occur
pointer manipulation
parameter is passed by reference and is also global to called method
parameter is passed by reference using same expression as an arg more once
Difference for globals between pass by ref and pass by value result
pass by ref - local var has link to global
pass by value result - treat local and global as separate in function, then when function returns update global
Call by name
every call statement is replaced by the body of the called method
each occurrence of a parameter in the called method is replaced with the corresponding arg
Benefit of call-by-name
more efficient when passing parameters that are never used