Thinking about style guidelines (Re: [cairo] Pattern rewrite)

Carl Worth cworth at cworth.org
Fri Jan 28 12:47:59 PST 2005


On Fri, 28 Jan 2005 08:28:27 -0800, Ned Konz wrote:
> Why not just come up with an appropriate indent.pro for GNU indent and point 
> people to that? That way, people can just filter their new code through 
> indent and get the format you want.

Someone can certainly try to cook something like that up once the
style guidelines are in place.

But there are several guidelines I I'd like to document beyond
indentation. There are things like the type naming style:

	descriptive_name_t;

as well as the preference for choosing matching identifier names when
possible:

	descriptive_name_t name;

And things like the general distaste for abbreviation, etc.

And even as far as indentation goes, I'm not sure if my style is
entirely mechanizable. So far, I only have it defined as far as "what
looks good to me", but I'll try to come up with something more precise
for the document.

For example, one of the conventions I'm considering is a preference
for an opening brace on the same line:

	for (a; b; c) {
	    /* ... */
	}

along with a recognition that certain cases look much better with the
brace on the following line:

	for (a_much_longer_a;
	     a_much_longer_b;
	     a_much_longer_c)
	{
	    /* ... */
	}

But that kind of thing can also often be made to look better by
rewriting things with temporaries so that it fits back on one line.

One of the reasons I hesitate about codifying the style guidelines is
that I'm not extremely rigid about imposing my style on others.

What I may do is go through the current code looking for things that
stand out as ugly to me and write those up.

Owen also recommended I consider the Gtk+ document as a starting
point, which I plan to look at.

-Carl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050128/29bcb7e8/attachment.pgp


More information about the cairo mailing list