At 09:12 2002-12-9 -0800, you wrote:
Well, I read all the posts I can find about this C vs. C++ issue and decided
to "convert" a large (and growing) app that we are developing from C to C++.

(We're using CW 8.3.)

I did a minimal conversion  of the app (made all the type casts explicit,
changed const char arrays to char ptr constants, etc.) and nothing more... I
did use a template for getting object pointers, but other than that, no
classes (just the same typedef's and struct's from the C version), no
exception handling, no nothing.  I didn't even load in the Palm glue or
standard C++ libraries. BTW this only took a couple of hours.

The C source created a 106K program on the emulator and the C++ version  was
221K.
I am very surprised to see the code size expand. I can think of two issues:

1) Do you have Macsbug symbols turned on? These are debugger symbols that are embedded in the program code and hold the names of your functions? C++ names are longer than C names, so the cost of having these symbols is much higher. They are not needed by the CW debugger, but are used by the Palm OS Emulator for some of its displays and profiling.

2) In the C/C++ Language panel, is exception handling turned on?

3) What optimization level is set in the Global Optimizations panel?

4) Is inlining enabled in the C/C++ language panel?

This template could be adding a lot of code, since there will be a version of it created for every different type used with it. It would be really useful to enable the link map option in the 68K Linker panel and look at the link maps from your C app and from your C++ app so you can see where size increases have occurred.

See http://www.palmoswerks.com/stories/storyReader$44 for a copy of my presentation from PalmSource 2002 on how to develop with C++ without rapidly increasing your code size.

--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com


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

Reply via email to