[tools-compilers] C99 variable-length array and lint warning

2009-10-15 Thread Peter Memishian
> >> int bar(void) > >> { > >> int a[foo()]; > >> ... > >> } > > I guess it is a bug in lint? Is there a directive > I can use to suppress lint warning in this case? Seems simpler to workaround it by doing: int bar(void) { int acnt = foo(); int a[acnt];

[tools-compilers] C99 variable-length array and lint warning

2009-10-14 Thread Kacheong Poon
Joerg Schilling wrote: >> int foo(void) >> { >> ... >> } >> >> int bar(void) >> { >> int a[foo()]; >> ... >> } > Variable length arrays do not help to avoid stack overflows. > VLAs should not be used if you don't know at compile time that the > actual size will always be within reasona

[tools-compilers] C99 variable-length array and lint warning

2009-10-14 Thread Joerg Schilling
Kacheong Poon wrote: > I have a question about lint warning on the following code. > > int foo(void) > { > ... > } > > int bar(void) > { > int a[foo()]; > ... > } > > Lint complains that the return value of foo() is ignored. > Isn't the above a valid way to use the variable-length > arr

[tools-compilers] C99 variable-length array and lint warning

2009-10-14 Thread Dave Pagan
Kacheong Poon wrote: > I have a question about lint warning on the following code. > > int foo(void) > { > ... > } > > int bar(void) > { > int a[foo()]; > ... > } > > Lint complains that the return value of foo() is ignored. > Isn't the above a valid way to use the variable-length > array

[tools-compilers] C99 variable-length array and lint warning

2009-10-14 Thread Kacheong Poon
I have a question about lint warning on the following code. int foo(void) { ... } int bar(void) { int a[foo()]; ... } Lint complains that the return value of foo() is ignored. Isn't the above a valid way to use the variable-length array feature (assuming it will not cause stack overflo