Denis Chatelain
2004-Sep-10 16:45 UTC
[Flac-dev] const issue in FLAC__lpc_compute_residual_from_qlp_coefficients (libFLAC/lpc.c:233)
Hello, I just tried to compile libFLAC (using Borland C++ Builder 6 on Windows). The compilers yells at me on line 233 of libFLAC/lpc.c *(residual++) = *(data++) - (sum >> lp_quantization); --> data is const and cannot be modified Funny thing is, if data is declared: const FLAC__int32 *data instead of const FLAC__int32 data[] everything is ok. Is this a bug in my compiler, or a personnal lack of understanding of the difference in C between *data and data[] ? Will changing const FLAC__int32 data[] to const FLAC__int32 *data will ruine everything ? Denis
Matt Zimmerman
2004-Sep-10 16:45 UTC
[Flac-dev] const issue in FLAC__lpc_compute_residual_from_qlp_coefficients (libFLAC/lpc.c:233)
On Tue, Jan 13, 2004 at 02:04:48PM -0800, Josh Coalson wrote:> --- Denis Chatelain <listes@octopodus.com> wrote: > > Hello, > > > > > > I just tried to compile libFLAC (using Borland C++ Builder 6 on > > Windows). > > > > The compilers yells at me on line 233 of libFLAC/lpc.c > > > > *(residual++) = *(data++) - (sum >> lp_quantization); > > --> data is const and cannot be modified > > > > Funny thing is, if data is declared: > > const FLAC__int32 *data > > instead of > > const FLAC__int32 data[] > > > > everything is ok. > > > > Is this a bug in my compiler, or a personnal lack of understanding of > > the difference in C between *data and data[] ? > > hmmm, not sure what the standard says on this. but it's > OK to change it to > > const FLAC__int32 *data > > in order to get it to compile.I haven't checked, and I don't recall whether it covers the case of const arrays, but this article has helped me in the past: http://www.parashift.com/c++-faq-lite/const-correctness.html -- - mdz
Josh Coalson
2004-Sep-10 16:45 UTC
[Flac-dev] const issue in FLAC__lpc_compute_residual_from_qlp_coefficients (libFLAC/lpc.c:233)
--- Denis Chatelain <listes@octopodus.com> wrote:> Hello, > > > I just tried to compile libFLAC (using Borland C++ Builder 6 on > Windows). > > The compilers yells at me on line 233 of libFLAC/lpc.c > > *(residual++) = *(data++) - (sum >> lp_quantization); > --> data is const and cannot be modified > > Funny thing is, if data is declared: > const FLAC__int32 *data > instead of > const FLAC__int32 data[] > > everything is ok. > > Is this a bug in my compiler, or a personnal lack of understanding of > the difference in C between *data and data[] ?hmmm, not sure what the standard says on this. but it's OK to change it to const FLAC__int32 *data in order to get it to compile. Josh __________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus
Josh Coalson
2005-Jan-25 20:05 UTC
[Flac-dev] const issue in FLAC__lpc_compute_residual_from_qlp_coefficients (libFLAC/lpc.c:233)
--- Josh Coalson <xflac@yahoo.com> wrote:> --- Denis Chatelain <listes@octopodus.com> wrote: > > Hello, > > > > > > I just tried to compile libFLAC (using Borland C++ Builder 6 on > > Windows). > > > > The compilers yells at me on line 233 of libFLAC/lpc.c > > > > *(residual++) = *(data++) - (sum >> lp_quantization); > > --> data is const and cannot be modified > > > > Funny thing is, if data is declared: > > const FLAC__int32 *data > > instead of > > const FLAC__int32 data[] > > > > everything is ok. > > > > Is this a bug in my compiler, or a personnal lack of understanding > of > > the difference in C between *data and data[] ? > > hmmm, not sure what the standard says on this. but it's > OK to change it to > > const FLAC__int32 *data > > in order to get it to compile.finally fixed in CVS. Josh __________________________________ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com