Memory management dilemma

Jeff Parsons jeffrparsons at optusnet.com.au
Mon May 29 06:02:16 PDT 2006


> I thought about this for a lot as well and here's what I came up with:
> 
> Use structs.
> 
> In D structs are copy on write, and therefore don't need memory management.
> This makes them ideal for simple mathematical primitives, but a terrible idea
> for larger objects. Classes on the other hand are pass by reference, and are
> allocated only in heap space.
> 
> If you would like to see an example, I have a vector/matrix library for
> Derelict/OpenGL that I've written.  I can post the source if anyone is
> interested.
> 
> -Mik


Thanks!

And sure, I'd like to see your implementation if it's not too much 
trouble. :)

-Jeff



More information about the Digitalmars-d mailing list