blob: 3bae23686d4079ddc79eee352f4930bdbe438bcf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<div class="subsection-level-extent" id="c99-like-fast-enumeration-syntax"> <div class="nav-panel"> <p> Next: <a href="fast-enumeration-details" accesskey="n" rel="next">Fast Enumeration Details</a>, Previous: <a href="using-fast-enumeration" accesskey="p" rel="prev">Using Fast Enumeration</a>, Up: <a href="fast-enumeration" accesskey="u" rel="up">Fast Enumeration</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="C99-Like-Fast-Enumeration-Syntax"><span>8.9.2 C99-Like Fast Enumeration Syntax<a class="copiable-link" href="#C99-Like-Fast-Enumeration-Syntax"> ¶</a></span></h1> <p>A c99-like declaration syntax is also allowed: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">id array = …;
for (id object in array)
{
/* Do something with 'object' */
}</pre>
</div> <p>this is completely equivalent to: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">id array = …;
{
id object;
for (object in array)
{
/* Do something with 'object' */
}
}</pre>
</div> <p>but can save some typing. </p> <p>Note that the option <samp class="option">-std=c99</samp> is not required to allow this syntax in Objective-C. </p> </div><div class="_attribution">
<p class="_attribution-p">
© Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br>
<a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/c99-like-fast-enumeration-syntax.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/c99-like-fast-enumeration-syntax.html</a>
</p>
</div>
|