On Wed, Oct 22, 2003 at 11:52:00PM +0200, Riccardo Cohen wrote:

> BUT when not sysAppLaunchFlagNewGlobals, I can't use a class that has a 
> virtual destructor because it needs global variables. So I removed the 
> "virtual" keyword from parent and child destructors. I noticed that both 
> destructors are called anyway !

If the object was created on the stack, then the compiler knows what
class of object it is and can call the correct destructor when it goes
out of scope. If the object is allocated from the heap (i.e., with
operator new), then operator delete will probably call the wrong
destructor, because the destructor is not declared virtual, so isn't
in the object's vtable.

> Moreover, it is written in doc "targeting_palm_os.pdf" that new and delete 
> cant be called if !sysAppLaunchFlagNewGlobals because they throw exceptions 
> and this needs globals.
> 
> HOW CAN YOU PROGRAM IN C++ IN THOSE CONDITIONS ???

Don't use objects and new/delete when you don't have
globals. Realistically, you won't be doing much when you don't have
globals, so you don't really need a lot of C++ there.

-- 
Dave Carrigan
Seattle, WA, USA
[EMAIL PROTECTED] | http://www.rudedog.org/ | ICQ:161669680
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL

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

Reply via email to