summaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2014-03-26 06:58:15 +0000
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2014-03-26 06:58:15 +0000
commitc051a2940b45464f0bd42959def3a10c91bf688b (patch)
tree73fbf5143620b481bbb51bdf7050a4ac03459168 /gcc/doc
parentf25f1b25ff2e084c6e1ca01b700c29b02a4bd94b (diff)
downloadgcc-c051a2940b45464f0bd42959def3a10c91bf688b.tar.gz
PR c/37428
* doc/extend.texi (C Extensions): Mention variable-length arrays in a structure/union. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208836 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/extend.texi12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 90bf6d841a0..19286226714 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