]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/37428 (GNU VLA-in-structure extension is undocumented)
authorMarek Polacek <polacek@redhat.com>
Wed, 26 Mar 2014 06:58:15 +0000 (06:58 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 26 Mar 2014 06:58:15 +0000 (06:58 +0000)
PR c/37428
* doc/extend.texi (C Extensions): Mention variable-length arrays in
a structure/union.

From-SVN: r208836

gcc/ChangeLog
gcc/doc/extend.texi

index ff4a21bcf83e30db84e92e48541c1bd63249f3a7..8680951ae1af6714fcf0df7fb2f4d638e703ee4c 100644 (file)
@@ -1,3 +1,9 @@
+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
index 90bf6d841a0f13ce94893a839e34dfc7e7bceb43..19286226714e6282a58a00ad6a0ac90f9e32b2d3 100644 (file)
@@ -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