[FFmpeg-devel] Array bug in aes.c
Rich Felker
dalias
Fri Jan 18 05:23:03 CET 2008
On Fri, Jan 18, 2008 at 05:08:35AM +0100, Michael Niedermayer wrote:
> > The problem is that gcc is wrongly enforcing array subscript bounds
> > for each dimension of the array rather than for the array as a whole.
> >
> > Arguably it would be better anyway (more expressive) to use:
> >
> > if(!enc_multbl[sizeof(enc_multbl)/sizeof(enc_multbl[0])-1][sizeof(enc_multbl[0])/sizeof(enc_multbl[0][0])-1]){
> >
> > but both are ugly to read. Using a preprocessor macro for the max
> > values in each dimension would make the code a lot more legible, IMO.
>
> why not
>
> if(!(&enc_multbl)[1][0][-1]){
gcc will give a warning for this for the same reason. It's clever
though.
rich
More information about the ffmpeg-devel
mailing list