Now I'll try an answer to the other question(s), see below ...


Am 03.04.2023 um 01:32 schrieb Paul Gilmartin:
Are the external semantics (not examining the generated assembly) of
"pass by content" any different from "pass by value"?   How?

maybe not

It would seem more efficient for the called function to perform the copy
rather than the caller because the code to perform the copy would exist
only once in the subroutine rather than at each point of call.

I don't think so.

If the copy would be done by the called routine, you would need two copies ...
first you would need to copy the addresses of the parameters to the stack
(because otherwise the called routine would not know where to copy the parameters from) and then the second copy in the called routine, which copies the values from the original place in the caller's area to the stack frame of the called routine. This takes more time to do it and additional stack space for the address list, and: this is true IMO, no matter what platform you are running on. It is therefore better to copy the values to the parameter list directly and this must be done by the caller; the caller has to prepare the parameter list. BTW: this is done this way by every compiler that I am aware of, my New Stanford Pascal compiler and every
other compiler that I have examined in the last years, different platforms.

This is maybe a time to space tradeoff, in the end ... but all compilers decide for time saving.

BTW: that's why IMO it's important to make a sharp distinction between call by value as described above and - for example - PL/1 dummy arguments, which is in fact call by reference with a copy of parameter values before - this is what COBOL calls "call by content". For the called routine there is no difference between call by reference, PL/1 dummy arguments
or COBOL's call by content ... all the same.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to