| From: | Bryce Nesbitt <bryce2(at)obviously(dot)com> |
|---|---|
| To: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
| Cc: | pgsql-patches(at)postgresql(dot)org |
| Subject: | Coding standards |
| Date: | 2008-04-18 06:44:46 |
| Message-ID: | 4808435E.2020200@obviously.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers 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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heikki Linnakangas | 2008-04-18 06:52:54 | Re: DROP DATABASE vs patch to not remove files right away |
| Previous Message | Bryce Nesbitt | 2008-04-18 06:36:14 | Re: Proposed patch - psql wraps at window width |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bryce Nesbitt | 2008-04-18 07:07:29 | Re: Proposed patch - psql wraps at window width |
| Previous Message | Bryce Nesbitt | 2008-04-18 06:36:14 | Re: Proposed patch - psql wraps at window width |