> 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.
Thanks but I'm not convinced. I still think this is buggy behaviour or bad documentation. My reasons for not being convinced are: A scalar and a matrix variable may refer to the same types of things (value, pointer, dyn array etc). Scalar variables with datum over eight bytes are pointers - same as a matrix variable. So in this case there is virtually no difference between a scalar variable and matrix variable. The documentation suggests that the effect of pass-by-value-parentheses will be the same on either scalar or matrix variable. The documentation says : "When data is passed by value, the contents of the variable in the main program do not change as a result of manipulations to the data in the subroutine." This rule breaks when passing a matrix variable "by value". The compiler will specifically fail on a "call xxx((mat array))" type syntax. This specifically excises passing whole dimensioned arrays by value (your HORRENDOUS struct scenario). The compiler does not fail on a "call xxx((array(9)))" type syntax suggesting to the developer that certain behaviour will be exhibited. This expected behaviour is not manifested. The compiler treats scalar or matrix variables differently. So, to summarise, I feel my thesis is sound and the U2 developers should either amend the documentation of fix the compiler so that passing a matrix variable by value works. Regards, Stuart Note: in researching this I discovered there are 2 types of dimensioned arrays Prime and Pick style. I tested this for both styles of array with negative results. ********************************************************************** 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