Coding standards - Mailing list pgsql-patches

From Bryce Nesbitt
Subject Coding standards
Date
Msg-id 4808435E.2020200@obviously.com
Whole thread Raw
In response to Re: Proposed patch - psql wraps at window width  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Coding standards  (Magnus Hagander <magnus@hagander.net>)
Re: Coding standards  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-patches
Alvaro Herrera wrote:
> People [are] complaining here that we don't teach people here anyway, so
> hopefully my comments were still useful :-)
>
Yes they are useful.  As a new patcher, where should I look for coding
standards?  How about a little FAQ at the
top of the CVS source tree?

Though, darn it, I sure like //

And my vi is set to:
  set sw=4
  set ts=4
  set expandtab
Because my corporate projects require spaces not tabs.

> Some random comments:
>
> * Don't use C++ style comments (//).  Some compilers don't like these.
>
> * Beware of brace position: we use braces on their own, indented at the
>   start of a new line, so
>
> !     while(--count) {
> !         lines++;
> !         lines->ptr   = NULL;
> !         lines->width = 0;
> !         }
>
> becomes
>
>
> !     while(--count)
> !       {
> !         lines++;
> !         lines->ptr   = NULL;
> !         lines->width = 0;
> !         }
>
> (with correct indentation anyway)
>
>
> * Always use tabs, not spaces, to indent.  Tabs are 4 spaces wide.
>
> * Don't use double stars in comments.
>
> * "} else" is forbidden too.  Use two separate lines.


pgsql-patches by date:

Previous
From: Bryce Nesbitt
Date:
Subject: Re: Proposed patch - psql wraps at window width
Next
From: Bryce Nesbitt
Date:
Subject: Re: Proposed patch - psql wraps at window width