X coding style

Ian Romanick idr at us.ibm.com
Mon May 8 08:16:05 PDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Daniel Stone wrote:
> On Tue, May 02, 2006 at 05:25:54PM -0700, Ian Romanick wrote:
>>Daniel Stone wrote:
>>
>>>Coding style wars are incredibly dumb.  Ian's agreed to follow the style
>>>of any code he patches, AFAICT (a sensible policy), so let's all just
>>>move on, and not bother trolling with coding style/editor wars.
>>
>>Many large open-source projects document what their coding style
>>guidelines are and what the rationale behind them is.  No such document
>>exists for X.org, but I strong believe that one should.  At the very
>>least a set of basic naming conventions (e.g., functions with these
>>attributes should be named xorgFoo) and a set of indent flags should be
>>documented.
> 
> Yes, that would be very nice, but for now, the only convention is, don't
> break the existing convention.  If you're working on your own code, then
> you can do what you like, but if you're working on other people's code,
> then play by their rules.
> 
> It's similar to someone coming in and committing their own bizzarely
> different coding style to Mesa.  It's just a basic form of respect.

So the problem with that is the internal inconsistency within
directories and even within a single file.  For example, there are
numerous cases of *both* of the following constructs within a single
file.  Which is the convention for that file?

	if (foo) {
	    ...
	} else {
	    ...
	}

	if (bar) {
	    ...
	}
	else {
	    ...
	}

Indentation of labels within case-statements is another area of pure chaos.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEX2C1X1gOwKyEAw8RAgtnAJ40NlLu3SOH3BTz0NqLrb6G0qtIgACdHREe
bGnICT/HPVecw+UbbEbl3rU=
=iNKX
-----END PGP SIGNATURE-----



More information about the xorg mailing list