[FFmpeg-devel] [PATCH] GET_RL_VLC can hide function parameters

Erik Hovland erik
Tue Jul 22 17:04:44 CEST 2008


On Tue, Jul 22, 2008 at 03:23:56PM +0100, M?ns Rullg?rd wrote:
> 
> Erik Hovland wrote:
> > On Tue, Jul 22, 2008 at 11:15:22AM +0300, Ivan Kalvachev wrote:
> >> On 7/22/08, Erik Hovland <erik at hovland.org> wrote:
> >> > The function parameter named 'n' is pretty popular in libavcodec. The
> >> > macro GET_RL_VLC also uses 'n'. That means that the parameter is hidden
> >> > w/in that macro. If the name of that int is changed to length, then the
> >> > parameter is never hidden.
> >> >
> >> > Functions that get their 'n' hidden by that macro:
> >> > ff_msmpeg4_decode_block
> >> > mpeg2_fast_decode_block_non_intra
> >> > mpeg2_decode_block_intra
> >> > mpeg2_decode_block_non_intra
> >> > mpeg1_fast_decode_block_inter
> >> > mpeg1_decode_block_inter
> >> > mpeg1_decode_block_intra
> >>
> >> In the math it is quite common to say stuff like "From first to the
> >> n-th member". The "n" is just short of "number" and e.g. in the very
> >> same function it is used together with nb_bits.
> >> More over we, have level and now length, 2 different variables that
> >> start with "le" have approximately same number of characters, this
> >> could actually make function harder to read as you'd need a little bit
> >> more awareness to distinguish the variable names. If you really insist
> >> on the change, then use the
> >> same name as it is in the structure "len".
> >>
> >> I hope your next patch would not be replacing each "i" with "index" ;)
> >
> > If i hid function parameters, then my next patch might just do that.
> 
> Wouldn't it be better to change the GET_RL_VLC macro to use names less
> likely to clash?

That is what the patch does. Is length too common as well?

E

-- 
Erik Hovland
mail: erik at hovland.org
web: http://hovland.org/
PGP/GPG public key available on request





More information about the ffmpeg-devel mailing list