<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="LASTUPDATED" content="06/17/05 11:09:43" />
<title>cpp_extensions</title>
<link rel="StyleSheet" href="../../book.css" type="text/css"/>
</head>
<body>
<h3>cpp_extensions</h3>
<p> Controls language extensions to ISO C++.</p>
<h5>Syntax</h5>
<p class="code">#pragma cpp_extensions on | off | reset
</p>
<h5>Targets</h5>
All platforms.<br />
<h5>Remarks</h5>
<p>If you enable this pragma, you can use the following extensions to the ANSI C++ standard that would otherwise be illegal:</p>
<ul>
<li>Anonymous struct & union objects</li>
</ul>
<blockquote>
<div class="listing"> #pragma cpp_extensions on<br />
void foo()<br />
{<br />
union {<br />
long hilo;<br />
struct { short hi, lo; }; // anonymous struct<br />
};<br />
hi=0x1234; <br />
lo=0x5678; // hilo==0x12345678 <br />
}</div>
</blockquote>
<ul>
<li>Unqualified pointer to a member function</li>
</ul>
<blockquote>
<div class="listing">
<p> #pragma cpp_extensions on<br />
struct Foo { void f(); }<br />
void Foo::f()<br />
{<br />
void (Foo::*ptmf1)() = &Foo::f; // ALWAYS OK</p>
<p> void (Foo::*ptmf2)() = f; // OK if you enable cpp_extensions.<br />
}</p>
</div>
</blockquote>
<ul>
<li>Inclusion of const data in precompiled headers.</li>
</ul>
<p>This pragma does not correspond to any setting . To check this setting, use the <span class="code">__option (cpp_extensions)</span>. This pragma is <span class="code">on</span> if generating Win32/x86-compatible object code; <span class="code">off</span> if not.</p>
<p></p>
<div id="footer">Copyright © 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>
</body>
</html>