286efd2012-03-24Henrik Grubbström (Grubba) <html> <head> <title>Pike Reference Manual - #if</title> <link rel='stylesheet' href='../../style.css' /> <style type='text/css'> svg line { stroke:#343434; stroke-width:2; } svg text { fill:#343434; } svg a { fill:#0768b2; text-decoration: underline; } </style> </head> <body link="#0768b2" alink="#002040" vlink="#0768b2"> <header> <div> <div style="text-align:right;">Extracted from as of .</div> <div style="overflow:hidden;"> <a href="http://pike.lysator.liu.se/" style="float:left; width:181px; height:41px; margin:10px; margin-left:22px; margin-right:25px; background-image:url('../../../images/pike_logo.gif');"></a> <div style="margin:10px; height:11px; margin-top:26px; margin-right:19px; overflow:hidden; background-image:url('../../../images/pike_line_middle.gif');"> <span style="float:left; width:5px; height:11px; background-image:url('../../../images/pike_line_left.gif');">&nbsp;</span> <span style="float:right; width:5px; height:11px; background-image:url('../../../images/pike_line_right.gif');">&nbsp;</span> </div> </div> </div> </header> <div> <div class="navbar"> <nav> <a href='../../index.html'><b class='top head'>Top</b></a> <a href='../../ex/cpp_3A_3A.html'><b class='head'>cpp::</b></a> <script></script> <noscript> <div class='sidebar'> <a href='../../ex/cpp_3A_3A/index.html'><b>Symbol index</b></a><br /> </div> </noscript> </nav> </div> <div class="navbox"> <nav> <div class="sidebar"> <a href="../../ex/cpp_3A_3A/_23error.html" class="left" ><img src="../../../images/prev.gif" hspace="3" border="0" alt="previous" >#error</a> <a href="../../ex/cpp_3A_3A/_23ifdef.html" class="right" >#ifdef<img src="../../../images/next.gif" hspace="3" border="0" alt="next" ></a> </div> </nav> </div> <div class="contentbox"> <article> <h1>Directive #if</h1> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Directive</span> <span class='homogen--name'><b>#if</b></span> </dt> <dd><p><code class='directive'>#if</code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>The <a class='ms reference' href='../cpp_3A_3A.html'>#if</a> directive can evaluate simple expressions and, if the expression is evaluates to true, "activate" the code block that follows. The code block ends when an <a class='ms reference' href='../cpp_3A_3A.html'>#endif</a>, <a class='ms reference' href='../cpp_3A_3A.html'>#else</a>, <a class='ms reference' href='../cpp_3A_3A.html'>#elseif</a> or <a class='ms reference' href='../cpp_3A_3A.html'>#elif</a> block is encountered at the same nesting depth.</p> <p> The <a class='ms reference' href='../cpp_3A_3A.html'>#if</a> expressions may include defines, integer, string and float constants, <tt>?:</tt>, <tt>||</tt> and <tt>&amp;&amp;</tt> operations, <tt>~</tt>, <tt>^</tt>, <tt>!</tt>, <tt>|</tt> and <tt>&amp;</tt> operations, <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&lt;=</tt>, <tt>&gt;=</tt>, <tt>==</tt> and <tt>!=</tt> operations, <tt>+</tt>, <tt>-</tt>, <tt>*</tt>, <tt>/</tt>, <tt>&lt;&lt;</tt> and <tt>&gt;&gt;</tt> operations and paranthesis.</p> <p> Strings may also be indexed with the <tt>[]</tt> index operator. Finally there are three special "functions" available in <a class='ms reference' href='../cpp_3A_3A.html'>#if</a> expressions; <a class='ms reference' href='../cpp_3A_3A/defined.html'>defined()</a>, <a class='ms reference' href='../cpp_3A_3A/efun.html'>efun()</a> and <a class='ms reference' href='../cpp_3A_3A/constant.html'>constant()</a>.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><a class='ms reference' href='../cpp_3A_3A.html'>#ifdef</a>, <a class='ms reference' href='../cpp_3A_3A.html'>#ifndef</a>, <a class='ms reference' href='../cpp_3A_3A.html'>#elif</a>, <a class='ms reference' href='../cpp_3A_3A.html'>#else</a>, <a class='ms reference' href='../cpp_3A_3A.html'>#endif</a>, <a class='ms reference' href='../cpp_3A_3A/defined.html'>defined()</a>, <a class='ms reference' href='../cpp_3A_3A/constant.html'>constant()</a>, <a class='ms reference' href='../cpp_3A_3A/efun.html'>efun()</a></p> </dd></dl> </article> <footer> <hr size="1" noshade="1" /> </footer> </div> </div> </body> <script>PikeDoc.current = {"link":"ex/cpp_3A_3A/_23if.html","name":"#if"};</script> <script src='../../ex/cpp_3A_3A/index.js'></script> <script src='../../ex/cpp_3A_3A/load_index.js'></script> </html>