Thanks Dave. So it is safe to use variable length array in C program on
linux machine, and I suppose all GCC on linux machines conform C99
although I never switch my C compilation to C99.
Thanks and sorry for FAQ questions.
Jim
Dave Korn wrote:
On 24 April 2006 12:09, YH wrote:
Hello,
YH writes:
>
> Is the following example legal in current GCC compilation for C
> program? I thought the static array allocation can only used by a
> defined constant such as char buf[MAX_SIZE], where #define MAX_SIZE 10?
>
> void DoSomthing(int size)
> {
>char buf[size];
>
On 24 April 2006 12:09, YH wrote:
> Hello,
>
> Is the following example legal in current GCC compilation for C
> program? I thought the static array allocation can only used by a
Not static! That's an automatic allocation on the stack.
> defined constant such as char buf[MAX_SIZE], where #
Hello,
Is the following example legal in current GCC compilation for C
program? I thought the static array allocation can only used by a
defined constant such as char buf[MAX_SIZE], where #define MAX_SIZE 10?
void DoSomthing(int size)
{
char buf[size];
.. do something