[FFmpeg-devel] Array bug in aes.c
Michael Niedermayer
michaelni
Fri Jan 18 11:35:28 CET 2008
On Thu, Jan 17, 2008 at 11:23:03PM -0500, Rich Felker wrote:
> 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.
I never tried to avoid the warning, just to simplify the code.
The warning is a bug in gcc and should be fixed in gcc. IMHO
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080118/767228d1/attachment.pgp>
More information about the ffmpeg-devel
mailing list