Re: Applications of C++
On May 11, 11:20 pm, Jorgen Grahn <grahn+n...@snipabacken.se> wrote:
On Wed, 6 May 2009 00:35:02 -0700 (PDT), Michael Doubez
<michael.dou...@gmail.com> wrote:
On 5 mai, 22:46, joshuamaur...@gmail.com wrote:
...
I'm curious, do you turn of RTTI and exception support? Do
you use exceptions? How does the (possibly imaginary) code
bloat affect your decision to use C++, or some of the newer
features of C++? (With virtual memory, such code bloat from
RTTI and exceptions generally does not matter. Embedded is
different.)
I don't think I have heard RTTI and exceptions being accused
of causing code bloat before. People usually complain about
the standard containers and iostreams.
Exceptions do tend to increase code size considerably, at least
with the most efficient implementations. (On the other hand,
I've not found std::vector making my programs any bigger than
they would have been otherwise.)
The C++ compilers for embedded system I have seen (IAR, and
ARMCC) don't implement RTTI and exceptions. There isn't
ostream as well and if there was, I suppose the codecvt
would be removed since it tends to bloat the code.
But keep in mind that "embedded systems" often translates to
"a full-blown computer running Linux, but with a bit of flash
memory instead of disk" these days. Some people call it
"embedded" as soon as there is custom hardware involved --
even if there are gigabytes of RAM and disk, and a few hundred
CPUs, and it runs Unix.
There are many different levels of "embedded": I've worked on
"embedded" systems which ran on a Sun Sparc, under Solaris, with
a moderate sized disk. I've also worked on embedded systems
with only 64 bytes of RAM and 2 KBytes of ROM. On the first, we
used full C++, with all the bells and whistles the compiler
supported at the time. On the second, we used assembler---even
C resulted in too much code bloat (or rather, too much RAM being
used).
GCC rules in that market, of course.
Or the native C++ of the platform. (I've seen more HP CC and
Sun CC than G++ in this field.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34