LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Function to return two values

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF Function with multiple return values jerminski73 Excel Worksheet Functions 6 April 28th 07 12:16 AM
A Function to Return Top 5 Values Only Sean Excel Worksheet Functions 4 December 29th 06 12:34 PM
vlookup function return all values j2thea Excel Worksheet Functions 20 November 2nd 05 10:32 PM
Return an array of values from a function Raul Excel Programming 6 December 13th 04 07:33 PM
Can a function return two values? Anil K. Excel Programming 5 August 13th 04 01:17 PM


All times are GMT +1. The time now is 05:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"