Luigi Ballabio | 29 Apr 21:14

Re: Disposable<T>


On Apr 29, 2008, at 5:55 PM, Luigi Ballabio wrote:

> On Mon, 2008-04-21 at 08:19 -0700, snovik wrote:
>> I am on the team to port ql to c# .net and trying to understand the 
>> reasons
>> behind Disposable<T> class. It looks to me like a tricky memory-saving
>> excercise and I wonder if it really is or there are other reasons.
>
> It's not for saving memory---it's for performance. C++ has pass-by-copy
> semantics.

Also, the same applies to assignment. In C++, when we write

a = b;

you don't end up with two references (a and b) referring to the same 
instance. You end up with a being a new copy of b.

Luigi

P.S. I almost forgot---good luck with your C# port...

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

Gmane