Re: A small rant about coding style for backend functions - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: A small rant about coding style for backend functions
Date
Msg-id 200711081617.lA8GHWG17979@momjian.us
Whole thread Raw
In response to Re: A small rant about coding style for backend functions  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: A small rant about coding style for backend functions  ("Brendan Jurd" <direvus@gmail.com>)
List pgsql-hackers
Alvaro Herrera wrote:
> > > Having said that, there are two or three tips worth knowing about
> > > pg_indent's behavior, like when and how to use dashes to prevent
> > > comment blocks from being re-flowed.  But it's a short list.
> 
> If someone submits a piece of code that's totally out of line with our
> standards, we will ask him to resubmit.  This step could be avoided if
> he knew what those standards were in the first place.

True, but 95% of the cases are submitters using the wrong functions,
methods, etc, not the style.  I don't remember us ever returning a patch
for rework based on style issues alone.

> PG_GETARG and the like are not fixed by pgindent though (which is what
> spawned this whole discussion).  And in-house code (or pgFondry code),
> which could also benefit by our coding style, will not be processed by
> pgindent anyway.
> 
> >     <P><I>pgindent</I> will the format code by specifying flags to your
> >     operating system's utility <I>indent.</I> This <A href=
> >     "http://ezine.daemonnews.org/200112/single_coding_style.html">article</A>
> >     describes the value of a consistent coding style.</P>
> 
> I don't understand why would you link to an article about the value of
> consistent coding style, and not provide a link to our own coding style.
> 
> I also don't understand why pgindent is assumed to be some sort of
> silver bullet to solve all our coding style problems.  It is better if
> we educate our developers instead of just having pgindent at the end of
> the cycle deal with the messed up code.  Up to now, this education has
> been one individual at a time, but it is much better if we can scale in
> a way that every individual wastes only his own time learning our rules.

We want patch submitters to spend their time on patches, not learning
our style.  The fact is that pgindent is a silver bullet in some ways.

My major contention is that any list is going to be very details and
hard to read, and no one has put up a list disputing that.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://postgres.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: New tzdata available
Next
From: Tom Lane
Date:
Subject: Re: New tzdata available