On 1 Aug 2001, at 0:00, Palm Developer Forum digest wrote:
> Subject: Re: C++ and GNU vs. CW
> From: "Jeff Wheeler" <[EMAIL PROTECTED]>
> Date: Tue, 31 Jul 2001 08:44:48 -0500
> X-Message-Number: 13
>
> > Does anyone have any recommendations GNU vs. CW for C++ development?
>
> No. (Just kidding.) I use CW, but haven't tried GNU.
I tried both. In CW there is 64kb data segment and in GNU tools I used only 32kB. So
large multisegment program with a lot of classes
which just fits to data segment in CodeWarrior is not compileable with GNU tools.
But generally gcc makes a way better optimalisations then CodeWarrior compiler so if
your application isn't too large it is probably the best choice
>
> > Also, what are the trade offs going form C to C++ in terms of runtime
> > proformance and code size?
>
> Many years ago, I went to a C++ presentation by Bjarne Stroustrup. He tried
> to convince us that C++ was just as efficient as C. As far as speed is
> concerned, he may be right (when comparing apples to apples), but it seems
> like the virtual function tables alone would cause some increase in the code
> size. I bet Ben Combe or one of the fine folks at Metroworks can give us
> some definitive information about that.
>
All C++ gurus think that C++ is as efficient as C, but that works if you have 1GHz
processor and a lot of RAM. Otherwise C++ is slower, not because of
compilation (because nearly every C++ program can be translated to plain C), but
because of all this object programming, which uses methods for access to
variables and all this useless stuff (useless from point of compiled code, unless all
methods are inlined). And if you turn on exceptions it is much slower
for a lot of additional checks. But all my thoughts about C++ are influenced by one
thing - I was never friend of objects and classes and plain C API is main
reason why I code for PalmOS
> Also for consideration, I think there are some issues related to C++ and
> global data restrictions. For instance, when you process some launch codes,
> you don't have access to global data. I seem to remember reading that this
> was a potential problem in C++ apps due to the virtual function tables that
> objects use. Again, maybe some one more knowledgable can fill us in, or
> refer you to an article on this subject.
I only found that if you declare aglobal variable of some class then at least
constructor and destructor must be in first segment. And from files generated
by Sybase Ultralite Generateor (ulgen) I learned that all unused inlined virtual
functions are always stored in first segment and there is no any way to move
them somewhere else (my first segment was 140kB long, so I had to write tool to strip
unused functions from ULDatabase.hpp)
>
> Jeff
I hope this will help a bit - if I wrote some big mistake let me know.
M.S.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/