aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2014-03-26 06:58:15 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2014-03-26 06:58:15 +0000
commitd615d763225f330cf5416c95ad0726db67e227b4 (patch)
tree73fbf5143620b481bbb51bdf7050a4ac03459168 /gcc
parent1b2265295a971edc5083140d8aeaa944534916a3 (diff)
downloadgcc-d615d763225f330cf5416c95ad0726db67e227b4.zip
gcc-d615d763225f330cf5416c95ad0726db67e227b4.tar.gz
gcc-d615d763225f330cf5416c95ad0726db67e227b4.tar.bz2
re PR c/37428 (GNU VLA-in-structure extension is undocumented)
PR c/37428 * doc/extend.texi (C Extensions): Mention variable-length arrays in a structure/union. From-SVN: r208836
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/doc/extend.texi12
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ff4a21b..8680951 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2014-03-26 Marek Polacek <polacek@redhat.com>
+ PR c/37428
+ * doc/extend.texi (C Extensions): Mention variable-length arrays in
+ a structure/union.
+
+2014-03-26 Marek Polacek <polacek@redhat.com>
+
PR c/39525
* doc/extend.texi (Designated Inits): Describe what happens to omitted
field members.
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 90bf6d8..1928622 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -1592,6 +1592,18 @@ Jumping or breaking out of the scope of the array name deallocates the
storage. Jumping into the scope is not allowed; you get an error
message for it.
+@cindex variable-length array in a structure
+As an extension, GCC accepts variable-length arrays as a member of
+a structure or a union. For example:
+
+@smallexample
+void
+foo (int n)
+@{
+ struct S @{ int x[n]; @};
+@}
+@end smallexample
+
@cindex @code{alloca} vs variable-length arrays
You can use the function @code{alloca} to get an effect much like
variable-length arrays. The function @code{alloca} is available in