Xorg coding style (Was: Re: Radeon TV-in support in Xorg CVS.)

Vladimir Dergachev volodya at mindspring.com
Sun Oct 3 13:36:02 PDT 2004


>>
>>     * No identation level for function bodies - there is nothing to
>>       confuse a function body with.
>>
>
> How did you arrive at this conclusion? I find it very confusing when you

Very easily - if you see code with no indentation it is a function body.

Structure declaration belong in header files and have their own 
indentation levels.

Global variables are normally few and are located at the top of the file.
Again, very hard to confuse with function body.

Btw, I am merely mentioning this to explain - I do not mean to insist in 
any way on this particular convention, just to show that it appears 
perfectly natural to one person - me.

> have a bunch of simple (i.e. no further indention levels) functions all
> packed together. Particularly with your minimal whitespace use and
> mixing of function prototypes with regular code.
>
> I'm sure it's perfectly usable for someone who knows the entire code and
> has worked on it for years, but it's not very nice for us "tourists".

Ronny, it is truly hard for me to believe that this convention is any 
harder to follow than, say, GNU 2 space tabs.

Hard, but not impossible - I have seen people who appeared to truly abhore
my writing style and whose style, while consistent, looked to me like
an entry in obfuscated C contest.

> I've only programmed commercially and "for fun" for about two decades
> but I've never seen anyone write C function bodies without indentation
> before.

Well, I don't know any other examples off hand, but I always wondered why 
people waste perfectly good space on the left so the file looks 
half-empty.

>
>>     * The blocks { /* body */ } are interchangeable with single statements:
>>
>>           if(condition)op1;
>>  		else op2;
>>
>>           if(condition){
>>  	 	op1;
>>  		} else {
>>  		op2;
>>  		}
>>
>
> This example, like most of your code, is begging for more whitespace.
>

It would really be nice if you explained to me why (off the list..) - 
maybe there is something I am missing that will make my life better.

Otherwise, lets just agree on a compromise: you are free to run indent if 
you want to (and commit the result into the tree) and I am free to not use 
your style as a way to express myself as I am really not comfortable with 
it. I prefer to think about what I am coding and not how many spaces it 
needs.

                          best

                            Vladimir Dergachev



More information about the xorg mailing list