Hello all, 

Just a few comments about C++ on the Palm that might be helpful in this 
context:

>From: "Miller, Gary" <[EMAIL PROTECTED]>
>Subject: RE: ::new(p) Foo;
>
>wow.  haven't seen OOP since i started Palm programming.  is that supported?
>
>> -----Original Message-----
>> From: Maarten L. Hekkelman [mailto:[EMAIL PROTECTED]]
>> Sent: Thursday, December 09, 1999 04:11 PM
>> To: [EMAIL PROTECTED]
>> Subject: ::new(p) Foo;

And

>Yes, you can use both C++ and the placement operator new in Palm programming.
>
>But something just occured to me since my last response: Don't put an object
>in
>a handle unless you really, really know what you are doing. You must make 
>sure
>that the object can stand moving around in memory.  If there are any internal
>pointers to data members, those pointers won't get updated and will be
>invalidated the next time the heap is compressed, shufffled, or re-arranged.
>Obvious examples are where you have one data member that points to another. A
>not-so-obvious example would be when you use multiple-inheritance with 
>virtual
>base classes.
>
>- -- Keith Rollin
>- -- Palm OS Emulator engineer


We've started putting a big comment in our C++ classes for classes that 
are safe to use inside of handles and that are safe to use at with non 
standard launch codes when you don't have global variables. These 
comments serve not only as a reminder of which classes are which, but 
they also remind us not to use certain dangerous  C++ features without 
care when we are modifying the code. 

As a general rule, you have to look for:

- Virtual functions

- Global or Static variables

- Base classes and any other classes contained in data members of the 
class also have to be safe. 

- When linking the code for all of these classes gets put into the first 
code segment so that they are available for non standard launch codes. 


Contrariwise, since your user interface classes always have globals 
available, they can freely use these features, and you can put their code 
into other code segments.

Best wishes,

--Catherine & Stuart
  www.llamagraphics.com

Reply via email to