Home |
Search |
Today's Posts |
#13
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bernd,
I take it you are referring to this comment - " Limit the number of parameters passed by reference (var parameters in Pascal, pointers passed in C). There are only two ways that a subroutine can screw up a variable in another subroutine: global variables and variables passed such that they can be changed. The problem in both cases is that you increase the chance that something will be changed in a way that you didn't expect. " The paper is all about style, by definition that's subjective albeit based on hard learnt experience. As a general comment I do not entirely disagree, however ByRef has a valid and useful purpose. Indeed in our example the only reason for the existence of the argument is to be able to pass it ByRef, for the sole purpose of returning it with a new value. For other purposes, where there is no deliberate intention to change the ByRef argument, it can still be worth sending ByRef where performance is an issue. It depends slightly on the data type but in general it's faster to send a pointer to the variable (ByRef) rather than make and send a copy of the variable (ByVal). Then let's agree to disagree. No problem :-) Regards, Peter T PS in VB/A ByRef is the default "Bernd P" wrote in message ... Hello Peter, [Not OT - w.r.t ByRef] Then let's agree to disagree. My basis is: http://ei.cs.vt.edu/~cs2604/Standards/Standards.html [Search for the first two occurances of "reference".] Regards, Bernd |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF Function with multiple return values | Excel Worksheet Functions | |||
A Function to Return Top 5 Values Only | Excel Worksheet Functions | |||
vlookup function return all values | Excel Worksheet Functions | |||
Return an array of values from a function | Excel Programming | |||
Can a function return two values? | Excel Programming |