[FFmpeg-devel] [PATCH 3/3] Implement inline function av_fill_image_max_step() and use it for factorizing code.

Michael Karcher ffmpeg
Wed Aug 18 14:20:20 CEST 2010

Am Mittwoch, den 18.08.2010, 13:48 +0200 schrieb Michael Niedermayer:
> > +static inline void av_fill_image_max_step(int max_step[4], int max_step_comp[4], const AVPixFmtDescriptor *pix_desc)
> > +{
> > +    int i;
> > +    memset(max_step     , 0, 4*sizeof(max_step     [0]));
> isnt sizeof(max_step) the same?

No. C is an evil language. As "int max_step[4]" is a parameter to a
function, and arrays passed as parameters decay to pointers, the
function declaration behaves like the parameter were "int *max_step".
And having sizeof(int*) == 4*sizeof(int) is quite unlikely.

If max_step were a local or global variable instead of a formal
parameter, sizeof(max_step) would have been working.

  Michael Karcher

More information about the ffmpeg-devel mailing list