Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 39,374 times

Contents

Related Categories

Passing Variables By Value or Reference - Summary

mrjdesign

Summary

To summarize this simple tutorial, I would like to suggest the following few things to think of.

  1. ByRef is faster to call, and it is the default for a good reason.
  2. Use ByRef if the value is very long. Why use a copy of a very long string, when all you need to do is use the memory address location?
  3. When using multiple options, order them ByRef, ByVal, Optional.
  4. Evaluate if a Constant will be constant at all times or if you can save your self re-coding hassles by using default Optional arguments.
  5. Come to think of it, did I just manage to make constants less constant or what?

An a final note to something I have often found out the hard way in all of my coding and after pounding out perfect code that never works as fast anywhere else as on my own computer.

Test, try, twist and turn, because no matter how much you learn form reading, the final speed check really comes around when you try the code and add a few timers to test it in practical forms.

As I have also learned, it is not always needed to have high speed on all you do, but if your function is for example used in recursive loops then more than ever should you look at details.

The number of repetitions will slow down the speed of your application enormously if you choose the wrong way to do things.


©2001 - All Rights Reserved - MRJ Design
The source code samples and information pertained within this document are considered copyrighted material and may not be re-distributed by electronic or other media in any form or fashion whatsoever, withou

Comments

  • Thanks :)

    Posted by mrjdesign on 05 Feb 2003

    It was fun to write it too... I still havn't gotten the hang on all ins and outs yet but I'm learning as I help others.

  • not that much

    Posted by http://vbxzone.tripo on 20 Nov 2001

    it was not a bad article. However it was kind of too abstract, and no code examples or anything. just pure bs on byref and byval

  • Informative

    Posted by outvit on 28 Oct 2001

    This was a very informative article. It was a pleasure to read.