CS 3304: Comparative Languages
Subprograms
[
Course Documents
] : [
Subprograms
]
Previous
Contents
Next
Keyword Index
Pass-By-Reference
inout mode
Pass an access path
Also called pass-by-sharing
Advantage: passing process is efficient
Disadvantages:
Slower accesses
Can allow aliasing:
Actual parameter collisions:
sub1(x, x);
Array element collisions:
sub1(a[i], a[j]); /* if i = j */
Collision between formals and globals
Root cause of all of these is: The called subprogram is provided wider access to nonlocals than is necessary
Pass-by-value-result does not allow these aliases (but has other problems!)