summaryrefslogtreecommitdiff
path: root/devdocs/gcc~13/subscripting.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/subscripting.html
new repository
Diffstat (limited to 'devdocs/gcc~13/subscripting.html')
-rw-r--r--devdocs/gcc~13/subscripting.html14
1 files changed, 14 insertions, 0 deletions
diff --git a/devdocs/gcc~13/subscripting.html b/devdocs/gcc~13/subscripting.html
new file mode 100644
index 00000000..a80e3b2e
--- /dev/null
+++ b/devdocs/gcc~13/subscripting.html
@@ -0,0 +1,14 @@
+<div class="section-level-extent" id="Subscripting"> <div class="nav-panel"> <p> Next: <a href="pointer-arith" accesskey="n" rel="next">Arithmetic on <code class="code">void</code>- and Function-Pointers</a>, Previous: <a href="escaped-newlines" accesskey="p" rel="prev">Slightly Looser Rules for Escaped Newlines</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="Non-Lvalue-Arrays-May-Have-Subscripts"><span>6.23 Non-Lvalue Arrays May Have Subscripts<a class="copiable-link" href="#Non-Lvalue-Arrays-May-Have-Subscripts"> ¶</a></span></h1> <p>In ISO C99, arrays that are not lvalues still decay to pointers, and may be subscripted, although they may not be modified or used after the next sequence point and the unary ‘<samp class="samp">&amp;</samp>’ operator may not be applied to them. As an extension, GNU C allows such arrays to be subscripted in C90 mode, though otherwise they do not decay to pointers outside C99 mode. For example, this is valid in GNU C though not valid in C90: </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">struct foo {int a[4];};
+
+struct foo f();
+
+bar (int index)
+{
+ return f().a[index];
+}</pre></div>
+</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/Subscripting.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Subscripting.html</a>
+ </p>
+</div>