<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: What do ByRef and ByVal mean to you?</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2005/04/28/what-do-byref-and-byval-mean-to-you/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2005/04/28/what-do-byref-and-byval-mean-to-you/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 23:42:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Jim Thomlinson</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/04/28/what-do-byref-and-byval-mean-to-you/#comment-39810</link>
		<dc:creator>Jim Thomlinson</dc:creator>
		<pubDate>Fri, 12 Jun 2009 17:14:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1108#comment-39810</guid>
		<description>&lt;p&gt;The fundamental difference between byref and byval is that by ref passes the variable into the function, where as byval makes a copy of the variable and passes that in. Knowing that question 1 is relatively obvious. Question 2 is a bit tougher. The issue is one of performance. Copying most variables is easy as the size is known, but a string is actually a null terminated array of characters so the copy requires more overhead. Question 3 is where it gets difficult because you need to understand that references to objects are handled by pointers and that the copy only copies the pointer and not the entire object. From that stand point I do not see any value to passing ByVal in #3. Let me know if I am off the mark here. Always good to learn.&lt;/p&gt;
&lt;p&gt;The only other question I would have asked is if you do not specify ByRef or ByVal then what is the default? Interesting how many people have no idea.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The fundamental difference between byref and byval is that by ref passes the variable into the function, where as byval makes a copy of the variable and passes that in. Knowing that question 1 is relatively obvious. Question 2 is a bit tougher. The issue is one of performance. Copying most variables is easy as the size is known, but a string is actually a null terminated array of characters so the copy requires more overhead. Question 3 is where it gets difficult because you need to understand that references to objects are handled by pointers and that the copy only copies the pointer and not the entire object. From that stand point I do not see any value to passing ByVal in #3. Let me know if I am off the mark here. Always good to learn.</p>
<p>The only other question I would have asked is if you do not specify ByRef or ByVal then what is the default? Interesting how many people have no idea.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: karthick</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/04/28/what-do-byref-and-byval-mean-to-you/#comment-39776</link>
		<dc:creator>karthick</dc:creator>
		<pubDate>Thu, 11 Jun 2009 06:48:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1108#comment-39776</guid>
		<description>&lt;p&gt;Thanks a lot for your short and excellent functions. &lt;/p&gt;
&lt;p&gt;Appreciate your publishment...thanks once again&lt;/p&gt;
&lt;p&gt;:D&lt;/p&gt;
&lt;p&gt;thanks&lt;br&gt;
Karthick&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks a lot for your short and excellent functions. </p>
<p>Appreciate your publishment&#8230;thanks once again</p>
<p> <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>thanks<br />
Karthick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ByRef and ByVal « Roy MacLeans VBA Blog</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/04/28/what-do-byref-and-byval-mean-to-you/#comment-39190</link>
		<dc:creator>ByRef and ByVal « Roy MacLeans VBA Blog</dc:creator>
		<pubDate>Fri, 01 May 2009 13:23:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1108#comment-39190</guid>
		<description>&lt;p&gt;[...] 2009   VBA Code 0&#160;Comments Tags: Software, VBA      I recently came across a discussion about ByRef and ByVal, which I found a bit confusing. So I thought I&#039;d summarise my (possibly mis-) understanding [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] 2009   VBA Code 0&nbsp;Comments Tags: Software, VBA      I recently came across a discussion about ByRef and ByVal, which I found a bit confusing. So I thought I&#8217;d summarise my (possibly mis-) understanding [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: greg</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/04/28/what-do-byref-and-byval-mean-to-you/#comment-23905</link>
		<dc:creator>greg</dc:creator>
		<pubDate>Sat, 05 May 2007 01:47:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1108#comment-23905</guid>
		<description>&lt;p&gt;I can tell there is more book smart than real life preactice in come of these responses.  A Value passed BYREF will chage the vlaue in the calling method, as most of us know.  What I have not seen anyone pick up on is the 1001 uses for passing values byref in a function.  How about the good old introduction to VB.NET book.  Most of realize that there are often times an integer of 0 may be returned back from a function without it being in error.  By (for example) returning a true or false back from the method or function we can say that the argument we passed into our parameter was infact successfuly processed.  Of course this is just one simplistic example.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I can tell there is more book smart than real life preactice in come of these responses.  A Value passed BYREF will chage the vlaue in the calling method, as most of us know.  What I have not seen anyone pick up on is the 1001 uses for passing values byref in a function.  How about the good old introduction to VB.NET book.  Most of realize that there are often times an integer of 0 may be returned back from a function without it being in error.  By (for example) returning a true or false back from the method or function we can say that the argument we passed into our parameter was infact successfuly processed.  Of course this is just one simplistic example.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie Collins</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/04/28/what-do-byref-and-byval-mean-to-you/#comment-12092</link>
		<dc:creator>Jamie Collins</dc:creator>
		<pubDate>Tue, 03 May 2005 08:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1108#comment-12092</guid>
		<description>&lt;p&gt;In response to #14:&lt;/p&gt;
&lt;p&gt;I think you *do* need to explain because I can see nothing in the article which creates a copy of an object instance. It would be a very handy thing to create a copy instance (rather than a copy pointer to the same instance) but I&#039;ve always considered it out of reach because of the fact a single COM object can be stored in multiple memory locations and hence have different references for each (think mulitple interfaces).&lt;br&gt;
Jamie.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>In response to #14:</p>
<p>I think you *do* need to explain because I can see nothing in the article which creates a copy of an object instance. It would be a very handy thing to create a copy instance (rather than a copy pointer to the same instance) but I&#8217;ve always considered it out of reach because of the fact a single COM object can be stored in multiple memory locations and hence have different references for each (think mulitple interfaces).<br />
Jamie.</p>
<p></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie Collins</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/04/28/what-do-byref-and-byval-mean-to-you/#comment-12091</link>
		<dc:creator>Jamie Collins</dc:creator>
		<pubDate>Tue, 03 May 2005 08:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1108#comment-12091</guid>
		<description>&lt;p&gt;Joseph: &quot;Are we looking at issues that have real life meaning here, or are we navel gazing?&quot;&lt;/p&gt;
&lt;p&gt;Good question. Remember the context is a job interview. &lt;/p&gt;
&lt;p&gt;I&#039;d expect everyone to know the answer to scenario a. If they gave me the answer I was looking after for scenario b then I&#039;d know they would have an appreciating of performance issues. If they gave a sensible answer for scenario b then they&#039;d have justified putting &#039;COM&#039; or &#039;ActiveX&#039; on their cv/resume. &lt;/p&gt;
&lt;p&gt;If they were confused by the latter two scenarios then the chances are they haven&#039;t much experience of component based or object oriented programming in VBA. Mentioning the concept of &#039;trusted code&#039; or the implications of marshalling (I didn&#039;t say the Function was in-process) would earn bonus points.&lt;/p&gt;
&lt;p&gt;You may find it interesting that the best answer I got to scenario b went something like, &#039; I think the answer is [incorrect assumption here] but I&#039;m really not sure. You&#039;ve got me interested though. What is the correct answer?&#039; This candidate starts Monday. How real life is that?&lt;/p&gt;
&lt;p&gt;Jamie.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Joseph: &#8220;Are we looking at issues that have real life meaning here, or are we navel gazing?&#8221;</p>
<p>Good question. Remember the context is a job interview. </p>
<p>I&#8217;d expect everyone to know the answer to scenario a. If they gave me the answer I was looking after for scenario b then I&#8217;d know they would have an appreciating of performance issues. If they gave a sensible answer for scenario b then they&#8217;d have justified putting &#8216;COM&#8217; or &#8216;ActiveX&#8217; on their cv/resume. </p>
<p>If they were confused by the latter two scenarios then the chances are they haven&#8217;t much experience of component based or object oriented programming in VBA. Mentioning the concept of &#8216;trusted code&#8217; or the implications of marshalling (I didn&#8217;t say the Function was in-process) would earn bonus points.</p>
<p>You may find it interesting that the best answer I got to scenario b went something like, &#8216; I think the answer is [incorrect assumption here] but I&#8217;m really not sure. You&#8217;ve got me interested though. What is the correct answer?&#8217; This candidate starts Monday. How real life is that?</p>
<p>Jamie.</p>
<p></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joseph</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/04/28/what-do-byref-and-byval-mean-to-you/#comment-11725</link>
		<dc:creator>Joseph</dc:creator>
		<pubDate>Fri, 29 Apr 2005 18:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1108#comment-11725</guid>
		<description>&lt;p&gt;I&#039;d like to know what practical impact the answers to these questions have.&lt;/p&gt;
&lt;p&gt;Are we looking at issues that have real life meaning here, or are we navel gazing?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I&#8217;d like to know what practical impact the answers to these questions have.</p>
<p>Are we looking at issues that have real life meaning here, or are we navel gazing?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Billkamm</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/04/28/what-do-byref-and-byval-mean-to-you/#comment-11717</link>
		<dc:creator>Billkamm</dc:creator>
		<pubDate>Fri, 29 Apr 2005 15:24:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1108#comment-11717</guid>
		<description>&lt;p&gt;In response to #11:&lt;/p&gt;
&lt;p&gt;This article can probably explain it better than I could:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.windowsdevcenter.com/pub/a/oreilly/windows/ron/objects.html?page=last&quot; rel=&quot;nofollow&quot;&gt;http://www.windowsdevcenter.com/pub/a/oreilly/windows/ron/objects.html?page=last&lt;/a&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>In response to #11:</p>
<p>This article can probably explain it better than I could:</p>
<p><a href="http://www.windowsdevcenter.com/pub/a/oreilly/windows/ron/objects.html?page=last" rel="nofollow">http://www.windowsdevcenter.com/pub/a/oreilly/windows/ron/objects.html?page=last</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jkpieterse</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/04/28/what-do-byref-and-byval-mean-to-you/#comment-11713</link>
		<dc:creator>jkpieterse</dc:creator>
		<pubDate>Fri, 29 Apr 2005 12:45:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1108#comment-11713</guid>
		<description>&lt;p&gt;I guess when the function needs to alter the content of more than just one (object) variable, ByRef comes in handy. &lt;/p&gt;
&lt;p&gt;If e.g. the function is set up to be a boolean function that denotes whether any errors have occurred inside the function, one needs to use byref arguments to get at the actual results of the function.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I guess when the function needs to alter the content of more than just one (object) variable, ByRef comes in handy. </p>
<p>If e.g. the function is set up to be a boolean function that denotes whether any errors have occurred inside the function, one needs to use byref arguments to get at the actual results of the function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/04/28/what-do-byref-and-byval-mean-to-you/#comment-11712</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Fri, 29 Apr 2005 12:12:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1108#comment-11712</guid>
		<description>&lt;p&gt;&quot;I said that the Function makes no change to the variable&#039;s value &quot;&lt;/p&gt;
&lt;p&gt;Oh, you meant the function by design makes no change. I thought you implied the function changed it but somehow the change wasn&#039;t reflected in the passed variable&#039;s value.&lt;/p&gt;
&lt;p&gt;Duh.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8220;I said that the Function makes no change to the variable&#8217;s value &#8220;</p>
<p>Oh, you meant the function by design makes no change. I thought you implied the function changed it but somehow the change wasn&#8217;t reflected in the passed variable&#8217;s value.</p>
<p>Duh.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

