[svlug] Embedded C++

Rick Kwan kwanrj02 at lightsaber.com
Tue Sep 16 08:22:43 PDT 2003


I had a discussion with an embedded systems developer about
strengths and weaknesses of C, C++, Ada, and Java in an
embedded environment.  He made the following observations:

1.  Many embedded programmer don't like C++ new and delete because
     they lose control over exactly how things are allocated or reused.
     Apparantly, these are not conducive to real-time predictability.
2.  Microsoft C++ allows explicit call of a constructor on an
     object, i.e.,
       foo->ClassFoo()
     but GNU G++ does not.  In the MS environment, this allows
     re-initialization of existing object without re-allocating memory.
     It is unclear if the C++ standard really allows this.

Just to set this in context, in our target environment,
   * memory and power consumption are often at a premium,
   * systems must be highly reliable (no reboot for months),
   * systems are increasingly autonomous (more forward before
     receiving directions from home base).
(You guessed right; this is not a consumer appliance.)

Any other embedded folks out there?
Do you avoid new/delete in C++?
Do you avoid C++ altogether?

--Rick Kwan (kwanrj02 at lightsaber.com)
   occasional embedded developer






More information about the svlug mailing list