core/com.nokia.carbide.cpp.compiler.doc.user/html/cpp_compiler/cpp_ctrl_var_scope.htm
author fturovic <frank.turovich@nokia.com>
Mon, 19 Jul 2010 16:13:24 -0500
changeset 1641 2b3996fc09a1
parent 0 fb279309251b
permissions -rw-r--r--
revised x86 compiler dates, graphics, CSS, and release notes
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>Controlling Variable Scope in for Statements</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>Controlling Variable Scope in for Statements</h3>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    11
<p>If you enable the Legacy for-scoping setting , the compiler generates an error when it encounters a variable scope issue that the ISO C++ standard disallows, but is allowed in the C++ language specified in <strong>The Annotated C++ Reference Manual</strong>.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    12
<p>With this option off, the compiler allows variables defined in a for statement to have scope outside the for statement.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    13
<div class="listing">
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    14
  <h4>Listing 1. Example of a Local Variable Outside a for Statement</h4>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    15
  <p>for(int i=1; i&lt;1000; i++) { /* ... */ }<br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    16
    return i; // OK in ARM, Error in Carbide.c++</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    17
</div>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    18
<p>This setting corresponds to the pragma <a href="../pragmas/p_arm_conform.htm">ARM_conform</a>. To check this setting, use <span class="code">__option (ARM_conform)</span>. By default, this setting is <span class="code">off</span>.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    19
<p>See <a href="../symbols/sym_settings.htm">Checking Option Settings</a> for information on how to use this directive. <br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    20
</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    21
<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
    22
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    23
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    24
</body>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    25
</html>