The "no gc" crowd

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Thu Oct 10 11:39:52 PDT 2013


On 10/10/13 20:28, Sean Kelly wrote:
> Isn't BigInt a struct?  I'd expect it to work via copying just like concrete types.

Yes, it's a struct, but somewhere inside its internals I think it contains 
arrays.  I'm not sure how that affects copying etc., but suffice to say that if 
you try the following:

     BigInt a = 2;
     BigInt b = a;
     b = 3;
     assert(a != b);
     assert(a !is b);

... then it passes.  So it behaves at least in this extent like a value type.

But suffice to say that it was an unpleasant surprise that I couldn't just take 
it and pass to a function accepting an unqualified BigInt argument.



More information about the Digitalmars-d mailing list