Re: static array size

2006-04-24 Thread YH
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,

Re: static array size

2006-04-24 Thread Andrew Haley
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]; >

RE: static array size

2006-04-24 Thread Dave Korn
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 #

Re: static array size

2006-04-24 Thread YH
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