I'm using C++ for my Palm OS application and was wondering if using new and
delete for creating/destroying pointers to classes is the right approach. I
would rather create a handle and lock unlock it when I access the class, are
there any issues with this I should be aware of? I'm thinking that the
following code would work:
MemHandle h;
MyClass *pClass;
h=MemHandleNew(sizeof(MyClass));
if (h)
{
pClass = (MyClass*) MemHandleLock(h);
pClass->MyClass(); // call the constructor
MemHandleUnlock(h);
}
...
if (h)
{
pClass = (MyClass*) MemHandleLock(h);
pClass->~MyClass(); // call the destructor
MemHandleUnlock(h);
MemHandleFree(h);
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/