I'd say that you use new to build objets, and in the constructors, try to use MemHandleNew when possible.

PS:standard new does not work if your app is launched without sysAppLaunchFlagNewGlobals because it uses global variables. There is another new/delete here :

void operator delete(void* ptr)
{ if (ptr) MemPtrFree(ptr); }
void* operator new(std::size_t size)
{ if (size == 0) size = 1; return MemPtrNew(size); }

but even with that, be careful with static and virtual members. They make your object not usable when sysAppLaunchFlagNewGlobals is not set (for instance for global search)

Timothy Dean wrote:

What is the prefered method for allocating memory on the heap dynamically
for objects created with C++?  Right now I use the keyword new.  Is it
better to use MemHandleNew?  If so, how would you do this?  Thanks.

Tim Dean




-- Riccardo Cohen

Articque
Les Roches
37230 Fondettes
France
web = http://www.articque.com
tel: +33 02 47 49 90 49
fax: +33 02 47 49 91 49


-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to