× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Rory Hewitt wrote:

As I understand it, if the variable passed has the same length/type as the
parameter definition, the address of the variable is passed directly; if it
has a different type or length, it's copied into a temporary variable, whose
address is passed to the procedure.

That's correct. Well, almost. For fixed-length string parameters (A,C,G), the address of the variable is also passed if the parameter is longer. And OPTIONS(*VARSIZE) can cause the address of the variable to be passed even if the parameter has a shorter length.


In the second case, I assume that if the called procedure *were* to
change the parameter, since it would only affect the temporary variable, it
wouldn't be a problem, whereas in the first case, it *could* affect the
variable in the calling program. Is this correct?

Yes, that's correct.


A low-level question then: In the second case (using a temporary variable),
is the storage for that variable freed immediately after the procedure has
returned control or what?


Yes. The temporary could be reused for something else after the procedure has returned control.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.