Maybe passing a matrix in parentheses DOES pass by value - it passes the
value of the matrix reference! Which still contains pointers to the
matrix elements ... :-)

With respect to the docu, I suspect it's meaningless when talking about
matrices because it's not talking about what you think it is. For the
same reason that C actively discourages passing structs by value (it's a
HORRENDOUS performance hit on anything beyond the trivial), I suspect UV
doesn't pass matrix CONTENTS by value for the same reason.

Cheers,
Wol

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Stuart Boydell
Sent: 17 February 2004 23:10
To: U2 Users Discussion List
Subject: [UV] Pass by value [was:Need/Want/Would like to know]

> I know that UDT passes by reference

Interesting. The UV documentation for the CALL statement says: "All
scalar
and matrix variables are passed to subroutines by reference. If you want
to
pass variables by value, enclose them in parentheses."

Enclosing a matrix in parentheses apparently does not actually work.
(UV10.0.7 aix)

Vlisting the difference between a scalar and a vector (1D matrix)
variable
surrounded by parentheses shows in the first example, using a scalar
variable, passes by value using a new internal variable _T0000. In the
second example, surrounding a vector in parentheses does nothing and the
vector is passed by reference, the same as if there were no parentheses.

--- 1
00005: CALL P2((A), MAT X)
00005 00022 : 0F8 move           A  => _T0000
00005 00028 : 01E call           "P2" _T0000 X

--- 2
00005: CALL P2((X(100)), MAT X)
00005 00018 : 01E call           "P2" X(100(1(X

Seems like a bug in the documentation.
Stuart














**********************************************************************
This email message and any files transmitted with it are confidential
and intended solely for the use of addressed recipient(s). If you have 
received this email in error please notify the Spotless IS Support
Centre (61 3 9269 7555) immediately who will advise further action.

This footnote also confirms that this email message has been scanned
for the presence of computer viruses.
**********************************************************************

-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users




***********************************************************************************

This transmission is intended for the named recipient only. It may contain private and 
confidential information. If this has come to you in error you must not act on 
anything disclosed in it, nor must you copy it, modify it, disseminate it in any way, 
or show it to anyone. Please e-mail the sender to inform us of the transmission error 
or telephone ECA International immediately and delete the e-mail from your information 
system.

Telephone numbers for ECA International offices are: Sydney +61 (0)2 9911 7799, Hong 
Kong + 852 2121 2388, London +44 (0)20 7351 5000 and New York +1 212 582 2333.

***********************************************************************************

--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users

Reply via email to