X coding style
Ian Romanick
idr at us.ibm.com
Tue May 2 17:25:54 PDT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Daniel Stone wrote:
> On Tue, May 02, 2006 at 03:16:52PM +0200, John Hughes wrote:
>>Ian Romanick wrote:
>>>Mark Kettenis wrote:
>>>
>>>How do you figure? The interface is modeled after the interface in
>>>libpci (part of pciutils), which was created long before the sysfs
>>
>>^^ notice correct use of parens, space before "(", after ")"
Right. But look at the code below. There are *NO* spaces on either
side of "(" or ")" in the original code. If I had written "in
libpci(part of pciutils)" in the text above or "some months ago(in
February)" in the text below, it would have been very difficult to read.
The vast majority of X code has whitespace on at least one side of a
punctuation elements that break up names ("->" and "." do not break up
names, so they do not get spaces). Just like spaces around punctuation
in western written languages, this aids readability. I do not
understand why parenthesis don't get the same treatment as ";", ",",
"=", and the comparators. It is very inconsistent, and, quite frankly,
it gives me a headache to read.
I will comply, but only under duress.
>>>interface was available, and has been ported to other platforms. There
>>>was quite a bit of discussion about this some months ago (in February).
>>
>>^^ again.
>>
>>>>- *pucByte = pciReadByte(pMga->PciTag,ulOffset);
>>>>+ pci_device_cfg_read_u8( pMga->PciInfo, pucByte, ulOffset );
>>>
>>>
>>>>Oh, and I really think you shouldn't change the coding style. Those
>>>>extra spaces after the the '(' are just plain ugly ;-).
>>>
>>>Yeah,beingabletoactuallyreadthecodeissuchahorriblething. :P
>>
>>No, to make the code readable follow the typographical conventions that
>>have been used for decades, if not centuries.
>
> 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.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
iD8DBQFEV/iSX1gOwKyEAw8RAgvcAJ9jmORv5jIfPVzZujjoN7FIEAzcuwCeN9HV
gZWL41dsRSelC1o48YOBEAc=
=tjsG
-----END PGP SIGNATURE-----
More information about the xorg
mailing list