⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 preproc9.htm

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTM
字号:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR" content="Quadralay WebWorks Publisher Professional Edition 6.0.5">
<meta name="TEMPLATEBASE" content="book_html">
<meta name="LASTUPDATED" content="12/04/03 16:06:14">
<title>12.2.6 Pragma ST_nosideeffects  </title>

<STYLE TYPE="text/css">
<!--
	span.Signal { text-transform: uppercase; font-family: Verdana }
-->
</STYLE>

</head>

<body link="#3366CC" vlink="#9999CC" text="#000000" alink="#0000CC" bgcolor="#FFFFFF"
background="images/backgrnd.gif">

<p><img src="images/stlogo.gif" width="106" height="83" align="left"
alt="logo here!"> </p>

<table width="331" border="0" align="right" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="a_refman.htm"><img src="images/navtoc.gif" width="84" height="23"
    border="0" alt="TOC"> </a></td>
    <td><a href="preproc8.htm"><img src="images/navprev.gif" width="80" height="23"
    border="0" alt="PREV"> </a></td>
    <td><a href="prepro10.htm"><img src="images/navnext.gif" width="83" height="23"
    border="0" alt="NEXT"> </a></td>
    <td><a href="a_refmaa.htm"><img src="images/navidx.gif" width="84" height="23"
    border="0" alt="INDEX"> </a></td>
  </tr>
</table>

<p><br clear="all">
</p>

<hr align="left">

<blockquote>
<h3>
  <a name="1212399"> </a><font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">12.2.6 	 Pragma ST_nosideeffects</font>
</h3>


<p>
  <a name="1204656"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">This pragma enables <strong>st20cc</strong> to be provided with more information about functions, whose behavior could otherwise be ambiguous, and therefore helps to maximize the degree of optimization performed.</font>
</p>


<p>
  <a name="1204657"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">Syntax:</font>
</p>


<a name="1206326"> </a><font size=2 face=Courier><strong>#pragma ST_nosideeffects (<font size=2 face=Courier><strong><em>function-name</em></strong></font>)<br></strong></font>



<p>
  <a name="1204658"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">where <font size=2 face=Courier><strong><em>function-name</em></strong></font> must have been declared but not defined or instanced before the pragma is encountered. A warning is generated and the pragma ignored if:</font>
</p>

<ul>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204659"> </a>the named function has been defined, part defined or instanced before the pragma is encountered,</font></p>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204660"> </a>its parameter is not a function identifier,</font></p>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204661"> </a>it is given more than one parameter or none at all.</font></p>
</ul>

<p>
  <a name="1204662"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">Functions marked as side-effect free enable <strong>st20cc</strong> to avoid making worst-case assumptions when compiling variables which are modified when the function is called. A function is side-effect free when, within the body of a function:</font>
</p>

<ul>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204663"> </a>there are no assignments to variables which are defined outside the function, including writing through a pointer where the pointer points to a variable defined outside the function, for example I/O or "passing by reference" are not allowed,</font></p>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204664"> </a>there are no assignments to static variables (although initialization of static variables within definitions are allowed),</font></p>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204665"> </a>there are no reads from or assignments to volatile variables,</font></p>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204666"> </a>there are no calls to functions which may have side-effects.</font></p>
</ul>

<p>
  <a name="1204667"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">Ensure that a function meets the above criteria before marking it with the pragma <font size=2 face=Courier><strong>ST_nosideeffects</strong></font>.<font  face="Verdana, Arial, Helvetica, sans-serif"><b> </b></font>If a function is marked as side-effect free and it does not meet the above criteria, <strong>st20cc</strong> reports an error. Assembler inserts, that is, <font size=2 face=Courier><strong>_  _asm</strong></font> statements and pointers to functions, are a particular risk area because unconsciously, a function may be introduced which breaks the above criteria. For this reason, <strong>st20cc</strong> generates a warning each time assembler code or a pointer to a function is encountered.</font>
</p>


<p>
  <a name="1205474"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif"><em>Note:	 These warning messages may be disabled by using the <font  face="Verdana, Arial, Helvetica, sans-serif"><b>ws</b></font> command line option.</em></font>
</p>

<p>
  <a name="1204669"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif"><strong>st20cc</strong> may mark a function as side-effect free, even though the pragma <font size=2 face=Courier><strong>ST_nosideeffects</strong></font><font  face="Verdana, Arial, Helvetica, sans-serif"><b> </b></font>has not been applied. Use of the <font  face="Verdana, Arial, Helvetica, sans-serif"><b>fcheck</b></font><font  face="Verdana, Arial, Helvetica, sans-serif"><b>referenced</b></font> command line option causes an information message to be generated if this occurs.</font>
</p>


<p>
  <a name="1204670"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif"><strong>st20cc</strong> only marks those functions that it detects as unambiguously side-effect free and which are not already marked. It is possible for there to be functions which are side-effect free that <strong>st20cc</strong> does not detect; for such functions, only the application of the pragma <font size=2 face=Courier><strong>ST_nosideeffects</strong></font><font  face="Verdana, Arial, Helvetica, sans-serif"><b> </b></font>causes these functions to be marked as side-effect free.</font>
</p>


<p>
  <a name="1204671"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">If a function that is side-effect free is externally visible, then it may be useful to put the pragma <font size=2 face=Courier><strong>ST_nosideeffects</strong></font> into the header file following the prototype of the function. This enables <strong>st20cc</strong> to generate better code for calls to that function from other files.</font>
</p>
</blockquote>

<hr>



<table width="331" border="0" align="left" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="a_refman.htm"><img src="images/navtoc.gif" width="84" height="23"
    border="0" alt="TOC"> </a></td>
    <td><a href="preproc8.htm"><img src="images/navprev.gif" width="80" height="23"
    border="0" alt="PREV"> </a></td>
    <td><a href="prepro10.htm"><img src="images/navnext.gif" width="83" height="23"
    border="0" alt="NEXT"> </a></td>
    <td><a href="a_refmaa.htm"><img src="images/navidx.gif" width="84" height="23"
    border="0" alt="INDEX"> </a></td>
  </tr>
</table>
<font size=1 face="Verdana, Arial, Helvetica, sans-serif">&nbsp; &copy; 2001, 2002, 2003 STMicroelectronics. All Rights Reserved.<br>
&nbsp; ADCS 7250966F</font>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -