On Tue, Dec 20, 2005 at 09:22:36PM +1100, Jean-Marc Valin wrote:> I'll try fixing that. It's funny "gcc -ansi -Wall" doesn't even complain > about it despite the fact it's not C89-compliant."gcc -ansi -pedantic -Wall" does the trick. Does seem like a bug if there are other major compilers that don't implement this though. Does the non-embedded MSVC also have this limitation? Note that just "gcc -ansi" doesn't actually build out of the box. Configure takes care of defining out use of the 'inline' keyword, but there still are a couple of C++-style comments. -r
Yeah, MSVC doesn't like that notation.. You can use alloca which allocates stuff on the stack instead I believe. -----Original Message----- From: speex-dev-bounces@xiph.org [mailto:speex-dev-bounces@xiph.org] On Behalf Of Ralph Giles Sent: Tuesday, December 20, 2005 9:52 AM To: Jean-Marc Valin Cc: Speex Mailing List Subject: Re: [Speex-dev] CVS compilation and EVC++ 4.0 On Tue, Dec 20, 2005 at 09:22:36PM +1100, Jean-Marc Valin wrote:> I'll try fixing that. It's funny "gcc -ansi -Wall" doesn't even complain > about it despite the fact it's not C89-compliant."gcc -ansi -pedantic -Wall" does the trick. Does seem like a bug if there are other major compilers that don't implement this though. Does the non-embedded MSVC also have this limitation? Note that just "gcc -ansi" doesn't actually build out of the box. Configure takes care of defining out use of the 'inline' keyword, but there still are a couple of C++-style comments. -r _______________________________________________ Speex-dev mailing list Speex-dev@xiph.org http://lists.xiph.org/mailman/listinfo/speex-dev
On Tue, Dec 20, 2005 at 09:57:13AM -0800, Duane Storey wrote:> Yeah, MSVC doesn't like that notation.. You can use alloca which allocates > stuff on the stack instead I believe.Ok. I've filed a bug against gcc. We'll see what happens. :) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25504 BTW, 'gcc -ansi -pedantic' warns about a lot more variable-size arrays than the one we've discussed in mdf.c. Could MSVC have some kind of partial support? Can you try the attached test case (from the gcc bug) and confirm it fails? -r -------------- next part -------------- /* test file for variable array sizes */ #include <stdio.h> int func(int N) { int array[N]; int i, v; for (i = 0; i < N; i++) { array[i] = i; } v = 0; for (i = 0; i < N; i++) { v += array[i]; } return v; } int main(int argc, char *argv[]) { int N = 100; int v = 0; v = func(N); printf("func(%d) = %d\n", N, v); return 0; }