Palm Eudora and EudoraWeb are mostly C++. Here's a few things found.

- Inlining is great for reducing code size

- Exception handling adds 5Kb of object code right off the top so we don't
use it. We strive not to create lots of little allocated objects because
of the overhead of allocating, deallocating memory and the overhead of
propagating errors up the call stack. For example we try to do one
allocation/form and use callbacks for things like drawing lists. (I know
not very C++-like)

- Inheritance consumes a little globals space for each use. Generally
we've avoided it. Also you can't use inheritance from anything you're
calling from a sub launch when you have no globals (e.g. find).

- Have done lots of disassembling to see what object code is generated.
In general writing C-like code that is structured like C++ generates
smaller object code than letting the C++ compiler do it. So we don't do
things like use arrays of objects.

- Because of the event handling structure of PalmOS (no context per form)
you have to have some set of static/global data, usually per form.


I'd say C++ is definitely a win on PalmOS, but you can't approach it like
you approach C++ elsewhere. If you're apps and the data they operate on is
small then the additional overhead from C++ written in the traditional way
may not be so much of a factor.

LL


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

Reply via email to