xf86-input-acecad revival

Daniel Stone daniel at fooishbar.org
Tue Apr 24 18:06:40 PDT 2007


On Wed, Apr 25, 2007 at 02:26:37AM +0200, Giuseppe Bilotta wrote:
> On Wednesday 25 April 2007 02:04, Daniel Stone wrote:
> > On Wed, Apr 25, 2007 at 01:38:32AM +0200, Giuseppe Bilotta wrote:
> > As a couple of stylistic comments, there are some pretty excessive
> > xf86Msgs (e.g. for DeviceProc), and it could probably do with some
> > overall linewrapping. 
> 
> Yep, the file is in a very sad state. Making it work was the highest
> priority, but I plan to reindent the whole thing and demote the debug
> messages to their appropriate status (debug). Is there some script I can
> run to make the source code comply with the X.org coding styles?

Heh.  I don't know of any script, but these seem to be the norms, as
documented by the wiki:
four-space indenting (no tabs)
opening brace of function on new line
opening brace of branches on _either_ same or new line (no consensus)
  if on new line, not indented at all
  code _always_ on newline, never on the same line as statement or brace
_either_ cuddling braces or not (no consensus)
switch/case indented to same level, code indented one deep
braces optional when not required (no consensus)
arguments indented to level of last group
  e.g.   foo(bar, baz, quux(meh, blah,
                            reallylongstatement));
spaces around operators (e.g. =)
space before conditionals
space _optional_ before function/macro calls (no consensus)
no spaces inside function arguments (e.g. foo( bar ) is bad)
traditionally, structures are declared:
 typedef struct {
     ...
 } FooRec, *FooPtr;
 but people seem to be moving away from this (personal bias alert)
use StudlyCaps or lowerInitialStudlyCaps for functions
 again, people seem to be moving away from this (again, personal bias)
comments in doxygen form (at least, in the server)
no c++-style comments /* this is alright */ // this is bad

In addition, it's not well-documented, but you can use at least named
initialisers and variadic macros from C99.  There are a bunch of _X_*
attributes documented in doc/c-extensions in the server, or in
X11/Xfuncproto.h.

I think that about covers it.  As you can see, there's no one style, and
people will always argue it to death.  But as long as you're consistent
within every file, and you don't mix up whitespace and code changes,
no-one's likely to care, unless you do something _really_ horrible like
use GNU style. :)

Cheers,
Daniel

> > Also, if your commit message could be a little 
> > more descriptive and the subjects a little shorter, that'd be great too.
> 
> I'll work on that :)
> 
> > But, thanks, and welcome! :)  I'll add your account in the morning;
> > please don't forget to update doc/xorg-docs/MAINTAINERS when you get it.
> 
> Sure, and thank *you*.
> 
> -- 
> Giuseppe "Oblomov" Bilotta
> 
> _______________________________________________
> xorg mailing list
> xorg at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xorg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20070425/978591fd/attachment.pgp>


More information about the xorg mailing list