In reply to dave_59:
In reply to puranik.sunil@tcs.com:
The problem when passing a variable by reference is that the code inside the function or task knows nothing about the lifetime of the argument being passed, it only know the location where it exists.
Hi Dave,
thanks for the explanation.
Now if the task tsk1 in my question has a parameter prm_out of the type output and this parameter is passed the local variable inside automatic function. Task writes to it at 10 ns. But it will not exist at 10 ns and this will also result in “accessing a variable that no longer exists.” So does this restriction apply to output parameters in addition to reference parameters also? Or the output parameter is simply copied on stack by called function/task and calling function in this case does not read it from stack since calling function no longer exists along with its variables. So output parameter is simply destroyed with stack?
Is this understanding correct?
regards,
-sunil