core/com.nokia.carbide.cpp.compiler.doc.user/html/emb_systems/emb_code_language.htm
author stechong
Wed, 20 Oct 2010 11:19:31 -0500
changeset 2165 2a7b5eccb0bc
parent 1641 2b3996fc09a1
permissions -rw-r--r--
Keeping PlatSim internal only.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1641
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"><html>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     2
<head>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     3
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     4
<meta http-equiv="Content-Style-Type" content="text/css" />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     5
<meta name="LASTUPDATED" content="06/17/05 11:09:43" />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     6
<title>Language-related strategies</title>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     7
<link rel="StyleSheet" href="../../book.css" type="text/css"/>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     8
</head>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     9
<body bgcolor="#FFFFFF">
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    10
<h3>Language-related Strategies</h3>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    11
<p>  Language-related strategies limit or avoid the use of ISO C++ features. While these features can make software design and maintenance easier, they can also increase code size.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    12
<ul>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    13
  <li>Virtual Functions&mdash;Not using virtual functions reduces code size.</li>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    14
  <li>Runtime Type Identification&mdash;Extra data is not generated if program does not use Runtime Type Identification (RTTI).</li>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    15
  <li>Exception Handling&mdash;While the Carbide.c++ compiler provides zero-overhead exception handling to provide optimum execution speed, it still generates extra object code for exception support.</li>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    16
  <li>Operator New&mdash;Do not throw an exception within the new operator.</li>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    17
  <li>Multiple and Virtual Inheritance</li>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    18
</ul>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    19
<h4>Virtual Functions</h4>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    20
<p>For optimal code size, do not use virtual functions unless absolutely necessary. A virtual function is never dead-stripped, even if it is never called.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    21
<h4>Runtime Type Identification</h4>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    22
<p>If code size is an issue, do not use RTTI because it generates a data table for every class. Disabling RTTI decreases the size of the data section.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    23
<p>The EC++ proposal does not allow runtime type identification.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    24
<p>See also &ldquo;Controlling RTTI&rdquo;.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    25
<h4>Exception Handling</h4>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    26
<p>If you must handle exceptions, be careful when using C++ exception handling routines. Carbide has a zero runtime overhead error handling mechanism. However, using exceptions does increase code size, particularly the exception tables data.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    27
<p>The EC++ proposal does not allow exception handling.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    28
<p class="note"><strong>NOTE</strong> The proposed ISO standard libraries and the use of the new operator require exception handling.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    29
<h4>Operator New</h4>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    30
<p>The C++ new operator might throw an exception, depending on how the runtime library implements the new operator. To make the new operator throw exceptions, set __throws_bad_alloc to 1 in the prefix file for your target and rebuild your library. To prevent the new operator from throwing exceptions, set __throws_bad_alloc to 0 in the prefix file for your target and rebuild your library.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    31
<p>See your release notes or Targeting manual for more information.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    32
<h4>Multiple and Virtual Inheritance</h4>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    33
<p>Implementing multiple inheritance requires a modest amount of code and data overhead. The EC++ proposal does not allow multiple inheritance.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    34
<p>For optimal code size, do not use virtual inheritance. Virtual base classes are often complex and add a lot of code to the constructor and destructor functions.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    35
<p>The EC++ proposal does not allow virtual inheritance.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    36
<div id="footer">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. <br>License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a></div>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    37
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    38
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    39
</body>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    40
</html>