[MPlayer-cvslog] r24941 - trunk/mplayer.c

Uoti Urpala uoti.urpala at pp1.inet.fi
Mon Nov 5 11:59:48 CET 2007


On Sun, 2007-11-04 at 17:37 +0100, Reimar Döffinger wrote:
> I'd happily agree with that if _every_ use (or at least assignment) of
> the variable had the type (though it would bloat the code, so not
> _really_ good either), but like this only the first use of the
> variable has the type, and if I stumble over the later uses it becomes
> much harder to find out the type, because I can't just simply look at
> the start of blocks (yes, I can use the search function, but that is
> additional effort and works badly with some names).

In the typical use case the declaration is within a few lines of the
uses and easier to find than at the start of the function. Of course you
can construct examples where placement at the start of the function is
better, but that's not very relevant - nobody is arguing that no
variable declaration may be at the start of a function.

In this particular case the variable was used on 3 consecutive code
lines (with comments in between), and to make sense of the code you'd in
practice need to read all 3 anyway. I do not believe that anyone would
find the declaration easier at the start of the function (except
possibly people who are totally unfamiliar with free declaration
placement, until they get used to it).

> You believe that using declarations this way results in better code. It
> seems the rest of use don't though. And that makes me really certain
> that it is not as clearly an advantage as you seem to believe.

I think there aren't many MPlayer developers who would 1) consider code
readability in general seriously and 2) have tested and evaluated
declarations seriously enough to form an informed opinion. If you first
consider it superficially and then support your opinion by the assumed
agreement of people who have likely considered the issue even less then
being "really certain" as a result sounds quite exaggerated.




More information about the MPlayer-cvslog mailing list