RE: pass by reference vs copy-in, copy-out

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Wed Mar 22 2006 - 04:03:48 PST
Probably either 2 or 3, indeterminate.

Shalom

> analog function myfunc(a,b);
>   inout a,b;
>   real a,b;
>   begin
>     b = 3;
>     a = 2;
>     myfunc = 2*b + 5;
>   end
> endfunction
> 
> and in the module:
> 
>   y = 4;
>   x = myfunc(y,y);
> 
> If the arguments are pass-by-reference, then the "address"
> of y is passed for arguments a and b, so that "a = 2;" also
> affects the value of b inside the function, and the result
> is that y=2 and x=9 in the module.
> 
> If the arguments are copy-in, copy-out, then x will get
> the value 11.  What happens to y?
Received on Wed Mar 22 04:04:18 2006

This archive was generated by hypermail 2.1.8 : Wed Mar 22 2006 - 04:05:22 PST