[DGD] Some questions

Ben Chambers bjchamb at bellsouth.net
Tue Apr 1 01:22:03 CEST 2003


If I wanted every object to have a pointer to the object daemon, I know I
would do something like:
object objectd;
objectd=...;

It should go in the auto object of course.  But wouldn't that be a memory
problem to have that many copies of pointers to the object daemon?  Is it
possible to just use like a static in C++ so that only one instance of the
pointer exists but they can all access it?

Also, in Design Patterns there a concept known as a flyweight.  This concept
works basically like this.  If you have a string such as char* msg=new
char[10]; strcpy(msg, "hello\n");, then instead of actually having multiple
copies of that string, you can copy the pointer, which is faster and saves
memory.  Is this possible to do using object pointers or something in DGD?
For example, for every instance of a weapon, instead of actually copying the
string, simply point to a copy of the text?  Would this make any difference
on performance (memory or speed wise?)

_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list