[FFmpeg-devel] [PATCH] deals with code that has no effect when executed

Erik Hovland erik
Thu May 29 21:56:52 CEST 2008

On Thu, May 29, 2008 at 09:14:10PM +0200, Michael Niedermayer wrote:
> On Thu, May 29, 2008 at 12:02:15PM -0700, Erik Hovland wrote:
> > On Thu, May 29, 2008 at 08:20:27PM +0200, Reimar D?ffinger wrote:
> > > On Thu, May 29, 2008 at 10:57:22AM -0700, Erik Hovland wrote:
> > > > All of the memset calls rely on the compiler to sizeof the array. If
> > > > a compiler does this then it is outside of the C standard.
> > > 
> > > I'd really like a citation of the C standard for that claim...
> > 
> > I guess I should do a better job of qualifying that statement. The C
> > standard does not allow for the sizeof operator to work on dynamic or
> > externally define types.
> > http://en.wikipedia.org/wiki/Sizeof
> sigh ...
> wikipedia is NOT the C standard (and thats a good thing). I wouldnt trust
> any publically editable source blindly.

Sorry. I was not trusting it blindly. I read it for accuracy. And it was
accurate for what it says. But unfortunately for me. I was
wrong about how I was applying it. I have reworked the patch to leave
out the changes to memset because in each one it is using sizeof
correctly on static arrays and not.

Where the standard is ambiguous is stating whether multi-dimensional
arrays are evaluated. If one were literal about the standard, it could
be that they are not since they are not specifically qualified. I will
attempt to figure out what the compiler does as homework before
submitting a patch  related to this again.

And I have attached my patch making the suggestions you made.

> Even less so when the public is mostly people who know java & vb and the
> information i search for is C ...

Wow, insulting wikipedia authors as well as java and vb programmers in one
sentence. Hat trick!


Erik Hovland
mail: erik at hovland.org
web: http://hovland.org/
PGP/GPG public key available on request
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-no-effect.patch
Type: text/x-diff
Size: 1961 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080529/7202e85b/attachment.patch>

More information about the ffmpeg-devel mailing list