[AccessD] DotNet passing by value

John W. Colby jwcolby at colbyconsulting.com
Fri Aug 26 06:21:46 CDT 2005


Oooops...

>.. passing anything else (including strings) by value.  

Should have said "by reference", i.e. placing a pointer to the object on the
stack.

John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John W. Colby
Sent: Friday, August 26, 2005 7:11 AM
To: dba-vb at databaseadvisors.com; 'Access Developers discussion and
problemsolving'
Subject: [AccessD] DotNet passing by value


As you might be aware, VB.Net (and I assume the other .net languages as
well) pass all variables by value.  But what does this mean, and is it true.
As you know, everything in .net is an object, even common variables such as
an integer or decimal etc.  Passing by value (in other languages) means
placing a COPY of the variable (or object in this case) on the stack as the
function is called.  In VBA for example, when you pass by value, it really
does ONLY for the simple data types, passing anything else (including
strings) by value.  

Imagine passing a string, which could be a million bytes, by value -
literally making a copy and passing that into the stack.  IIRC the total
stack space for a given program in an Intel machine is something like 128
kbytes which means that passing a single (huge) string by value could cause
a stack overflow.  Now DotNet comes along claiming to pass everything by
value.  Is this more doublespeak?  And if so, what is the truth?

John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com






More information about the AccessD mailing list