summaryrefslogtreecommitdiff
path: root/devdocs/gcc~13/case-ranges.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/gcc~13/case-ranges.html
new repository
Diffstat (limited to 'devdocs/gcc~13/case-ranges.html')
-rw-r--r--devdocs/gcc~13/case-ranges.html10
1 files changed, 10 insertions, 0 deletions
diff --git a/devdocs/gcc~13/case-ranges.html b/devdocs/gcc~13/case-ranges.html
new file mode 100644
index 00000000..9473195d
--- /dev/null
+++ b/devdocs/gcc~13/case-ranges.html
@@ -0,0 +1,10 @@
+<div class="section-level-extent" id="Case-Ranges"> <div class="nav-panel"> <p> Next: <a href="cast-to-union" accesskey="n" rel="next">Cast to a Union Type</a>, Previous: <a href="designated-inits" accesskey="p" rel="prev">Designated Initializers</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</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="section" id="Case-Ranges-1"><span>6.30 Case Ranges<a class="copiable-link" href="#Case-Ranges-1"> ΒΆ</a></span></h1> <p>You can specify a range of consecutive values in a single <code class="code">case</code> label, like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">case <var class="var">low</var> ... <var class="var">high</var>:</pre>
+</div> <p>This has the same effect as the proper number of individual <code class="code">case</code> labels, one for each integer value from <var class="var">low</var> to <var class="var">high</var>, inclusive. </p> <p>This feature is especially useful for ranges of ASCII character codes: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">case 'A' ... 'Z':</pre>
+</div> <p><strong class="strong">Be careful:</strong> Write spaces around the <code class="code">...</code>, for otherwise it may be parsed wrong when you use it with integer values. For example, write this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">case 1 ... 5:</pre>
+</div> <p>rather than this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">case 1...5:</pre>
+</div> </div><div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 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/Case-Ranges.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Case-Ranges.html</a>
+ </p>
+</div>