    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: Impression of C++ for Embedded Systems</title>
        <link>https://members.accu.org/index.php/articles/868</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>




<div class="xar-mod-head"><span class="xar-mod-title">Design of applications and programs + CVu Journal Vol 11, #3 - Apr 1999</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c13/">Topics</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c67/">Design</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c76/">Journals</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c77/">CVu</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c132/">113</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/c67-132/">Any of these categories</a>

                    -                        <a href="https://members.accu.org/index.php/articles/c67+132/">All of these categories</a>
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;Impression of C++ for Embedded Systems</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 03 April 1999 13:15:30 +01:00 or Sat, 03 April 1999 13:15:30 +01:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<div class="section" lang="en">
<div class="titlepage">
<h2><a name="d0e20" id="d0e20"></a></h2>
</div>
<p>If you think about C++ you think about probably think about
programming a PC, a MAC, a RS/6000 etc. but not an embedded system.
The effort for embedded systems is very high. It is not possible to
port a complex application that is written in C++ to an embedded
system without any changes. Of course the frontend doesn't really
change. What changes is the backend. The code that is produced by
the backend for an embedded system is named embedded code. Such a
kind of code runs e.g. on any kind of front panel. Today it is very
important to think about the possibility of programming embedded
systems in C++ because the applications for them are ever
increasing in size and become ever more complicated.</p>
<p>In earlier days you could distinguish between low-level and
high-level systems. Today the lines between these have blurred very
much. To program embedded systems special languages are available
which support the underlying embedded system. Each language has its
own special features. In some cases a language with special
features is available for a special embedded system. If you read
design papers of C++ for embedded systems you will find out two
very important points: The first is that the language standard is
snipped e.g. currently templates cannot be used or some features
are not completely available e.g. simple inheritance instead of
multiple.</p>
<p>It depends on the efforts of the application if it makes sense
to use such compilers. In the most cases you program embedded
systems in C (or in assembly). One of the biggest problems is how
to handle the memory. Most C++ compilers for embedded systems only
support non-dynamic memory handling. On embedded systems garbage
collection is often necessary also the distribution of code. The
problem is that neither of these language items is fixed in the
standard of C++.</p>
<p>Of course in some compilers they are implemented but not in a
very clear way. At this point it is important not to misunderstand
the sense of C++. C++ is a programming language and not a
workbench. That is the reason why it is necessary that you find a
way to use the complete language on an embedded system and not only
a few parts of it. The consequence is that C++ needs variable
backends which port C++ e.g. to C. The next step is that the C
compiler produces the optimised embedded code. Most C++ compilers
which produce assembly code in a direct way do that very
ineffectively. The assembler code that is produced out of the same
program, first compiled by a C compiler and second by a C++,
differs in markedly. The code of the C compiler is much more
compact than that produced by the C++ program. You can try it out
by writing a simple &quot;hello-world&quot; program and compile it with a C
and than with the C++ compiler by using the -S option.</p>
<p>I know that this comparison is not really right but I hope you
know what I mean. Because of this fact it is much more important to
build, as mentioned above, variable backends for C++. In addition I
am sure that Java becomes more and more important for embedded
systems because for the writing of GUIs. Such GUIs can be used on
an embedded system and on different kinds of computers on which a
JVM is available without changing the code. Because of this fact a
JVM must be available on the intended embedded system. In the most
cases this is not so. The consequence is to port the Java code to
C. The same is true for C++. The performance of a C++ compiler
backend is too poor. I think it is not enough to use e.g. Java to C
compilers for embedded systems but also C++ to Java compilers to
use the power of C++ in Java programs. But that's not the point of
this article.</p>
<p>C++ can be used for embedded systems for several reasons. The
most important reason is that the design of software is done by
using object-oriented methods like the UML. So it is very
comfortable and would be easy if you could also use an
object-oriented language to realise the design in a language. The
software that is needed today for embedded systems becomes more and
more complex so it is necessary to use C++ to get a short
development cycle. Especially for user interfaces, C++ represents
the most popular solution to program such ones.</p>
<p>The problem is how to handle C++ in an effective way. Before
starting with the programming in C++ on an embedded system it is
necessary that you do a very good design covering all main items of
the problem you want to solve.</p>
<p>Especially the performance of a C++ program must be examined
very carefully. It is not efficient to solve a program in an
object-oriented way if the performance is low. Finally you have to
find out about the technological side of using C++. Does the
embedded system have enough resources to handle C++ programs and do
you have all necessary tools. To program an embedded system in C++
differs greatly from programming a Pentium processor.</p>
<p>A very special point is the memory handling. You have to make
sure that the used compiler can handle dynamic memory. Another
point is the overhead of some language features.</p>
<p>Templates have a very big overhead. By using templates the
performance of the application goes down. To solve this problem it
is necessary that the selected compiler uses an optimisation
mechanism that reduces the overhead of several language parts like
templates.</p>
<p>Generally you have to find an optimisation strategy like the
&quot;inline&quot; construct which kills the overhead of small functions.
&quot;inline&quot; does not work very well on big functions, only on small
ones.</p>
<p>Today an often used way is to migrate C code to C++ code. This
way is very difficult and not very safe. To do so it is necessary
and useful to examine the advantages and the disadvantages to do
such a work. I will try to explain my experiences about that theme
in one of the next &quot;Overloads&quot;.</p>
<p class="c2"><span class="remark">Those with an interest in
embedded C++ should contact Henrik. I wish my German was as good as
his English (I had to do fairly little editing to the above, yes I
know it could have been further polished)</span></p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
