ByRef vs. ByVal

Results 1 to 2 of 2

Thread: ByRef vs. ByVal

  1. #1
    Join Date
    Dec 1969

    Default ByRef vs. ByVal

    hi,<BR><BR>i&#039;m using vbscript and need to pass an array to a function. i&#039;m using a multidimensional array and it&#039;s pretty big. it can be at max 10 by 9. i&#039;ve read articles where it says it&#039;s more efficient to use ByVal instead of ByRef. But is this still true if we need to pass in a large array. i though it might be faster to use byref since then the server won&#039;t have to make a second copy of the array to pass into the function. does anyone know if this is true?<BR><BR>thanks,<BR>anna

  2. #2
    Join Date
    Dec 1969

    Default RE: ByRef vs. ByVal

    Well, byref is more efficient since you&#039;re just passing memory addresses.... byval makes a copy. It really depends on if you want to make changes directly to the array or not.<BR><BR>I wouldn&#039;t worry about efficiency too much... it&#039;s not that big of an array... but if you wanted to keep it standard, you could do it byref. For instance, in C++, you can only pass an array byref to a function... <BR><BR>A matter of preference, I s&#039;pose.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts