|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> |
|
2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
3 <head> |
|
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> |
|
5 <meta http-equiv="Content-Style-Type" content="text/css" /> |
|
6 <meta name="LASTUPDATED" content="06/17/05 11:09:43" /> |
|
7 <title>warn_implicitconv</title> |
|
8 <link rel="StyleSheet" href="../../book.css" type="text/css"/> |
|
9 </head> |
|
10 |
|
11 <body> |
|
12 <h3>warn_implicitconv</h3> |
|
13 <p> Controls the issuing of warnings for all implicit arithmetic conversions.</p> |
|
14 <h5>Syntax</h5> |
|
15 <p class="code">#pragma warn_implicitconv on | off | reset |
|
16 </p> |
|
17 <h5>Targets</h5> |
|
18 All platforms.<br /> |
|
19 <h5>Remarks</h5> |
|
20 <p>If you enable this pragma, the compiler issues a warning for all implicit arithmetic conversions when the destination type might not represent the source value. Listing 10.40 provides an example.</p> |
|
21 <div class="listing"> |
|
22 <h4>Listing 10.40 Example of Implicit Conversion</h4> |
|
23 <p>#pragma warn_implicitconv on // required to enable warnings<br /> |
|
24 #pragma warn_impl_f2i_conv on // enable conversion warning<br /> |
|
25 #pragma warn_impl_i2f_conv on // enable conversion warning<br /> |
|
26 #pragma warn_impl_s2u_conv on // enable conversion warning </p> |
|
27 <p>float f;<br /> |
|
28 signed int si;<br /> |
|
29 unsigned int ui;</p> |
|
30 <p>int main()<br /> |
|
31 {<br /> |
|
32 f = si; // WARNING<br /> |
|
33 si = f; // WARNING<br /> |
|
34 ui = si; // WARNING<br /> |
|
35 si = ui; // WARNING<br /> |
|
36 }</p> |
|
37 </div> |
|
38 <p>For more information about this warning, see “Implicit Arithmetic Conversions”.</p> |
|
39 <p class="note"><strong>NOTE</strong> This option “opens the gate” for the checking of implicit conversions. The sub-pragmas <a href="p_warn_impl_f2i_conv.htm">warn_impl_f2i_conv</a>, <a href="p_warn_impl_i2f_conv.htm">warn_impl_i2f_conv</a>, and <a href="p_warn_impl_s2u_conv.htm">warn_impl_s2u_conv</a> control the classes of conversions checked.</p> |
|
40 <p>This pragma corresponds to the Implicit Arithmetic Conversions setting . To check this setting, use <span class="code">__option (warn_implicitconv)</span>, described in <a href="../symbols/sym_settings.htm">Checking Settings</a>. The default setting is <span class="code">off</span>.</p> |
|
41 <p></p> |
|
42 <div id="footer">Copyright © 2009 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> |
|
43 |
|
44 |
|
45 </body> |
|
46 </html> |