Different for C.
I wrote many ASSEMBLER functions callable from C
and looked at (oh so many) dumps (mine and others)
which were generated by errors in C programs. The "by value" doubles,
for example, are part of the R1 parameter list. Not sure for large
structures ...
What you describe for extern "OS" and maybe C++
is the same mechanism that PL/1 calls a "dummy argument".
But this is technically not the same as true call by value.
It is what I call "call by reference with a premature copy of the
argument". Sure it logically has the same effect.
Kind regards
Bernd
Am 27.04.2017 um 01:27 schrieb Charles Mills:
As someone who has written a fair number of C++-callable z/OS assembler
routines I can assure you that even though it is call-by-value, the callee's
entry R1 points to a list of addresses. Here is working code in assembler that
picks up an integer (R10 is the entry R1 and PARM2 EQU 4).
L R2,PARM2(,R10) Address of Length in R2
L R0,0(,R2) Length in R0
Here's the declaration of the function in C++
extern "OS" { void FREEMAIN(void *address, const unsigned int size); }
(Which, BTW, I guess answers my out-loud musing. Even though it is conceptually
call-by-value, the address of (a copy of, presumably) the packed field is
passed to printf().
In the assembler routine, call by value and call by reference (& notation) look
the same. The only visible difference I know of is whether the list off of R1
points to the variable or a copy of the variable.
Charles
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN