Regardless of the implementation, call by reference is about more than efficiency; sometimes a subroutine is required to alter one of its parameters, and call by value doesn't allow that.
-- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 ________________________________________ From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of Bernd Oppolzer [bernd.oppol...@t-online.de] Sent: Sunday, April 2, 2023 4:26 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: ASM call by value Does this mean that, in the cases where the argument fits within the width of the parameter list, PL/X passes the actual value somehow? (which IMO means: the value goes into the parameter list). Or does it also in these cases only rely to the interface definition (and calls by reference)? Sorry about that: when I was at the (oral) exam for my computer science grade, I only got "good" and not "very good"; my prof told me that's because I'm a technician and not a scientist; I'm always focused on the implementation too much :-) my bad ... but that doesn't change any more after 40 years. I would like to compare this to C, because IMO, in C, it is up to the programmer to decide if he or she wants larger parameters to be copied in the call by value case or if they should be passed by reference for performance reasons. BTW: you are using C for z/OS development, too, as I am told. Would you tell us if you use C with the standard C linkage or with something like #pragma linkage (...,OS)? Thank you, kind regards Bernd Am 01.04.2023 um 15:34 schrieb Peter Relson: > I was taught long ago that "call by value" meant simply that whatever the > target routine did to a parameter was not reflected back to the caller's > argument. There are multiple possible implementations. One is to make a copy > and pass the argument by reference to the copy. Another is to pass the actual > value (somewhere, somehow). > > For what it's worth, the internal PL/X that much of z/OS is written in only > supports call by value for the cases where the argument fits within the > "width" of a parameter list entry (by convention, 4-bytes for an AMODE 31 > call, 8-bytes for an AMODE 64 call). PL/X's "call by value" never copies > (accompanied by passing the copy by reference). We have many places where our > dynamic storage is strictly limited such that "copy" is often not a > possibility. So what happens if you have something larger than fits but don't > want it changed? Too bad. Or make your own copy. The interface definition > shared by the source and target identifies whether the parameter is to be > treated as input-only or not. It is up to the compiler to help identify > places where the target code writes into something that is input-only and > passed by reference. > > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN