Coding standards

Поиск
Список
Период
Сортировка
От Bryce Nesbitt
Тема Coding standards
Дата
Msg-id 4808435E.2020200@obviously.com
обсуждение исходный текст
Ответ на Re: Proposed patch - psql wraps at window width  (Alvaro Herrera <alvherre@commandprompt.com>)
Ответы Re: Coding standards  (Magnus Hagander <magnus@hagander.net>)
Re: Coding standards  (Alvaro Herrera <alvherre@commandprompt.com>)
Список 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 по дате отправления:

Предыдущее
От: Bryce Nesbitt
Дата:
Сообщение: Re: Proposed patch - psql wraps at window width
Следующее
От: Bryce Nesbitt
Дата:
Сообщение: Re: Proposed patch - psql wraps at window width