| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> |
| <title>Block Statement</title> |
| <link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css"> |
| <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> |
| <link rel="home" href="../../../index.html" title="Chapter 1. Phoenix 3.0"> |
| <link rel="up" href="../statement.html" title="Statement"> |
| <link rel="prev" href="../statement.html" title="Statement"> |
| <link rel="next" href="if__statement.html" title="if_ Statement"> |
| </head> |
| <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| <table cellpadding="2" width="100%"><tr> |
| <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td> |
| <td align="center"><a href="../../../../../../../index.html">Home</a></td> |
| <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td> |
| <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> |
| <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> |
| <td align="center"><a href="../../../../../../../more/index.htm">More</a></td> |
| </tr></table> |
| <hr> |
| <div class="spirit-nav"> |
| <a accesskey="p" href="../statement.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../statement.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="if__statement.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> |
| </div> |
| <div class="section"> |
| <div class="titlepage"><div><div><h4 class="title"> |
| <a name="phoenix.modules.statement.block_statement"></a><a class="link" href="block_statement.html" title="Block Statement">Block Statement</a> |
| </h4></div></div></div> |
| <p> |
| Syntax: |
| </p> |
| <pre class="programlisting"><span class="identifier">statement</span><span class="special">,</span> |
| <span class="identifier">statement</span><span class="special">,</span> |
| <span class="special">....</span> |
| <span class="identifier">statement</span> |
| </pre> |
| <p> |
| Basically, these are comma separated statements. Take note that unlike |
| the C/C++ semicolon, the comma is a separator put <span class="bold"><strong>in-between</strong></span> |
| statements. This is like Pascal's semicolon separator, rather than C/C++'s |
| semicolon terminator. For example: |
| </p> |
| <pre class="programlisting"><span class="identifier">statement</span><span class="special">,</span> |
| <span class="identifier">statement</span><span class="special">,</span> |
| <span class="identifier">statement</span><span class="special">,</span> <span class="comment">// ERROR! |
| </span></pre> |
| <p> |
| Is an error. The last statement should not have a comma. Block statements |
| can be grouped using the parentheses. Again, the last statement in a group |
| should not have a trailing comma. |
| </p> |
| <pre class="programlisting"><span class="identifier">statement</span><span class="special">,</span> |
| <span class="identifier">statement</span><span class="special">,</span> |
| <span class="special">(</span> |
| <span class="identifier">statement</span><span class="special">,</span> |
| <span class="identifier">statement</span> |
| <span class="special">),</span> |
| <span class="identifier">statement</span> |
| </pre> |
| <p> |
| Outside the square brackets, block statements should be grouped. For example: |
| </p> |
| <pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> |
| <span class="special">(</span> |
| <span class="identifier">do_this</span><span class="special">(</span><span class="identifier">arg1</span><span class="special">),</span> |
| <span class="identifier">do_that</span><span class="special">(</span><span class="identifier">arg1</span><span class="special">)</span> |
| <span class="special">)</span> |
| <span class="special">);</span> |
| </pre> |
| <p> |
| Wrapping a comma operator chain around a parentheses pair blocks the interpretation |
| as an argument separator. The reason for the exception for the square bracket |
| operator is that the operator always takes exactly one argument, so it |
| "transforms" any attempt at multiple arguments with a comma operator |
| chain (and spits out an error for zero arguments). |
| </p> |
| </div> |
| <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> |
| <td align="left"></td> |
| <td align="right"><div class="copyright-footer">Copyright © 2002-2005, 2010 Joel de Guzman, Dan Marsden, Thomas Heller<p> |
| Distributed under the Boost Software License, Version 1.0. (See accompanying |
| file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) |
| </p> |
| </div></td> |
| </tr></table> |
| <hr> |
| <div class="spirit-nav"> |
| <a accesskey="p" href="../statement.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../statement.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="if__statement.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> |
| </div> |
| </body> |
| </html> |