realbasic-nug
[Top] [All Lists]

Re: byVal not working with arrays?

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: byVal not working with arrays?
From: Charles Yeomans <yeomans at desuetude dot com>
Date: Tue, 31 May 2005 13:48:44 -0400
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20050317180027 dot 4312B7BABB0 at lists dot realsoftware dot com> <p06210273bec227fe56cb at [192 dot 168 dot 1 dot 2]>

On May 31, 2005, at 10:45 AM, Robert Woodhead wrote:

Was playing around with some recursion today in which it would be handy to recursive on an array. So passing the array byVal so each instance of the method would have its own copy seemed like just the ticket.

Except that it seems that if you declare a parameter as:

byVal a() as Integer

it actually gets passed by reference!

This is not good. It's either a bug, or if it is intended that byval not work with arrays, then it needs to be redlined in the documentation in 48pt font that it doesn't!


If you want to pass a copy of an array, then you need to copy the array yourself and pass the copy without using either ByVal or ByRef.


--------------
Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>