From d615d763225f330cf5416c95ad0726db67e227b4 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 26 Mar 2014 06:58:15 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 6 ++++++ gcc/doc/extend.texi | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ff4a21bcf83e..8680951ae1af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-03-26 Marek Polacek + + PR c/37428 + * doc/extend.texi (C Extensions): Mention variable-length arrays in + a structure/union. + 2014-03-26 Marek Polacek PR c/39525 diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 90bf6d841a0f..19286226714e 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 -- 2.47.2