Re: Coding standards

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Coding standards
Дата
Msg-id 20080418152711.GC4850@alvh.no-ip.org
обсуждение исходный текст
Ответ на Coding standards  (Bryce Nesbitt <bryce2@obviously.com>)
Ответы Re: Coding standards  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-patches
Bryce Nesbitt wrote:
> 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?

The developer's FAQ is supposed to contain this kind of thing, but I
think it's rather thin on actual details.  (Some time ago it was
proposed to create a "style guide", but people here thought it was a
waste of time and "it will not cover what's really important", so we're
stuck with repeating the advice over and over.)

> 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.

I use this:

:if match(getcwd(), "/home/alvherre/Code/CVS/pgsql") == 0
:  set cinoptions=(0
:  set tabstop=4
:  set shiftwidth=4
:  let $CSCOPE_DB=substitute(getcwd(), "^\\(.*/pgsql/source/[^/]*\\)/.*", "\\1", "")
:  let &tags=substitute(getcwd(), "^\\(.*/pgsql/source/[^/]*\\)/.*", "\\1", "") . "/tags"
:  let &path=substitute(getcwd(), "^\\(.*/pgsql/source/[^/]*\\)/.*", "\\1", "") . "/src/include"
:endif

Of course, you need to adjust the paths.  The cscope, tags and path
things let me quickly navigate through the files, but they don't affect
the editor behavior.

I never set expandtab so it's not a problem for me, but I guess you can
do ":set noexpandtab" in that block to reset it for Postgres use.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

В списке pgsql-patches по дате отправления:

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: Proposed patch - psql wraps at window width
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Proposed patch - psql wraps at window width