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

Michael Niedermayer michaelni
Thu May 29 21:14:10 CEST 2008

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.
Even less so when the public is mostly people who know java & vb and the
information i search for is C ...

ISO/IEC 9899:TC2 Committee Draft  May 6, 2005 The sizeof operator
2 The sizeof operator yields the size (in bytes) of its operand, which may be an
  expression or the parenthesized name of a type. The size is determined from the type of
  the operand. The result is an integer. If the type of the operand is a variable length array
  type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an
  integer constant.

3 When applied to an operand that has type char, unsigned char, or signed char,
  (or a qualied version thereof) the result is 1. When applied to an operand that has array
  type, the result is the total number of bytes in the array.85) When applied to an operand
  that has structure or union type, the result is the total number of bytes in such an object,
  including internal and trailing padding.

7 EXAMPLE 3     In this example, the size of a variable length array is computed and returned from a
           #include <stddef.h>
           size_t fsize3(int n)
                  char b[n+3];              // variable length array
                  return sizeof b;          // execution time sizeof


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- 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/20080529/188d9dd9/attachment.pgp>

More information about the ffmpeg-devel mailing list