>> Current SVN compilation fails on Win32 (Intel C++ compiler 9.0): >> >> ..\..\libspeex\mdf.c(317): error: declaration may not appear after >> executable statement in block >> float adapt_rate; >> >> Just moved it up to the variable declaration block to solve it locally, but >> as it's not valid C, I thought I'd mention it ;) > > Where have you been the past 6 years? It is valid C99 (even if it's confusing > for non-C++-minded people)."restict" is also valid C99, but as that was removed for compatibility with non-compliant compilers, I thought one might wish to fix this as well, especially as it's the only place in the code it is used.
Thorvald Natvig wrote:> "restict" is also valid C99, but as that was removed for compatibility > with non-compliant compilers,That means "restrict" is no longer part of the standard and hence should not be accepted by standards conforming compilers. However, the issue you were complaining about is still part of the standard and any compiler which doesn't accept it is not C99 conformant.> I thought one might wish to fix this as > well, especially as it's the only place in the code it is used.However, if Jean-Marc would like to remove this construct and make sure it doesn't creep back in, he might be interested in the -Wdeclaration-after-statement GCC warning option. I believe that this -W flag is available in gcc-3.4 and later. If you are interested, I can also supply you with an M4 autoconf macro that can be used to add this to CFLAGS if and only if the compiler supports it. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ Good advice for everyone : stay away from churches, mosques and synagouges.
> > "restict" is also valid C99, but as that was removed for compatibility > > with non-compliant compilers, > > That means "restrict" is no longer part of the standard and hence should > not be accepted by standards conforming compilers. However, the issue you > were complaining about is still part of the standard and any compiler > which doesn't accept it is not C99 conformant.No, what he means is that I removed the only occurence of "restrict" in Speex (not that it was removed from C99). I did that temporarily for compatibility reasons and because it didn't help much anyway. I'll probably re-introduce it later with "#define restrict" for compilers that don't support it.> > I thought one might wish to fix this as > > well, especially as it's the only place in the code it is used. > > However, if Jean-Marc would like to remove this construct and make sure > it doesn't creep back in, he might be interested in the > > -Wdeclaration-after-statementI usually compile with -ansi once in a while to fix this. I've reorganizing code lately, which is why it appeared. So, in summary, I do intend to fix this and make sure Speex remains C89-compatible. Jean-Marc