[MPlayer-dev-eng] [bikeshed] Coding style

Michael Niedermayer michaelni at gmx.at
Mon Jun 16 14:14:13 CEST 2008


On Mon, Jun 16, 2008 at 01:45:22PM +0200, Luca Barbato wrote:
> Given that some people seems to be fine with the cleanup weekend here 
> something to start a nice flame:

Its nice to see a flame dancing in the spring, here amongth the darkness
of decay. Maybe not all is lost yet ;)


> 
> We could decide a coding style and try to be consistent as much as possible.
> 
> I like trying to leave spaces when possible but I like better having 
> *pointer, conditional blocks should keep the bracket in the same line, 
> functions the line immediately after.
> 
> e.g.
> 
> if () {
> 
> } else {
> 
> }
> 
> type var = value,
> 
> type *var = value;
> 
> type *function(type *name)
> {
> 
> }
> 
> What would you like or hate more?

I do not like spaces, i like ommiting {} if and only if it does
cost a extra line. 4 space indention, no tabs (or only tabs),
switch&case on the same indention level, ...

if(){
    X;
}else if(){
    Y;
}else
    Z;

type var= value;

type *var= value;

type *function(type *name)
{

}

switch(){
case a:
    aaa
    break;
case b:
    bbb
    break;
}

PS: and of course stuff vertically aligned where it helps readability. That
is

disjhfksdjhfkhs= 1;
fddf= 4;
dsfkjsdkjfksjh= 3;
fkjdshfkjhdskfjhskjfhskd= 6;
dkjfhdskjf= 7;
sdkjfksjfhkjsh= 0;
fksjdfhksd= 8;

vs.

disjhfksdjhfkhs         = 1;
fddf                    = 4;
dsfkjsdkjfksjh          = 3;
fkjdshfkjhdskfjhskjfhskd= 6;
dkjfhdskjf              = 7;
sdkjfksjfhkjsh          = 0;
fksjdfhksd              = 8;


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- 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/mplayer-dev-eng/attachments/20080616/7a84c4ab/attachment.pgp>


More information about the MPlayer-dev-eng mailing list