[MPlayer-dev-eng] [PATCH] ve_lavc cosmetics

Rich Felker dalias at aerifal.cx
Sun Feb 12 21:51:51 CET 2006


On Sun, Feb 12, 2006 at 06:47:35PM +0100, Diego Biurrun wrote:
> On Sun, Feb 12, 2006 at 06:35:57PM +0100, Michael Niedermayer wrote:
> > 
> > i do not agree with
> > * x=y / x = y changes
> 
> Why?  It's more readable IMO, especially if it is inconsistently used in
> the file.

IMO which is more readable depends STRONGLY on the context. For
instance:

for (i=0; i<10; i++)
vs
for (i = 0; i < 10; i++)

(the former is much more readable since the spacing breaks it into
logical units)

if ((x=bar(y)) > 10)
vs
if ((x = bar (y)) > 10)

(same reasoning)

if ( (x==1) || (x>10) )
vs
if ((x == 1 ) || (x > 10 ))

i=10 + bar();
vs
i = 10+bar();

i+j+5==100-k
vs
i + j + 5==100 - k
vs
1+j+5 == 100-k

The idea that whitespace should conform to a single 'coding style'
rule is IMO very misguided. The purpose of whitespace is to break the
logical units (logical in terms of how humans think about it, not how
the machine things) up in a way that makes them easier to read. This
depends on the semantics of the code, not the syntax.

In some cases, spacing mirrors the operator precedence that could be
made explicit by parentheses, but without the readability-damaging
properties of parentheses.

Rich




More information about the MPlayer-dev-eng mailing list