Re: AW: [HACKERS] LONG varsize - how to go on (pgindent)

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: AW: [HACKERS] LONG varsize - how to go on (pgindent)
Дата
Msg-id 386086CC.2E3125FB@tm.ee
обсуждение исходный текст
Ответ на AW: [HACKERS] LONG varsize - how to go on (pgindent)  (Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>)
Список pgsql-hackers
Tom Lane wrote:
> 
> Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at> writes:
> > I think the idea at that time was also, that with a tab only setup
> > people can look at the code with 2 space, 3 space and 4 space indents,
> > whatever suits them best.
> 
> Not really.  If the code still looked OK at different tab widths, people
> wouldn't be complaining.  A fairly typical example is
> 
>     if (root->query_pathkeys == NIL ||
>         pathkeys_contained_in(root->query_pathkeys,
>                               final_rel->cheapestpath->pathkeys))
>     {
>         root->query_pathkeys = final_rel->cheapestpath->pathkeys;
> 
> which is really
> 
> <tb>if (root->query_pathkeys == NIL ||
> <tb><tb>pathkeys_contained_in(root->query_pathkeys,
> <tb><tb><tb><tb><tb><tb><tb>  final_rel->cheapestpath->pathkeys))
> <tb>{
> <tb><tb>root->query_pathkeys = final_rel->cheapestpath->pathkeys;

So we either need ident that understands C syntax and formats the 
above as 

<tb>if (root->query_pathkeys == NIL ||
<tb><tb>pathkeys_contained_in(root->query_pathkeys,
<tb><tb>                      final_rel->cheapestpath->pathkeys))
<tb>{
<tb><tb>root->query_pathkeys = final_rel->cheapestpath->pathkeys;

or just use spaces for indentation

I transferred all my coding to spaces-only after starting with python 
about 5-6 years ago, as in python the whitespace is meaningful to parser 
too and not only to human reader.
Python has even a special script for detecting space/tab combinations 
that can potentially break things.

And it would be easy for someone who desparately needs tabs in his code
to run a much-simpler-than-indent script on the spaces only source to get 
what we have currently (and another script to put the spaces back before 
submitting patches)

-------------------
Hannu


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

Предыдущее
От: Tatsuo Ishii
Дата:
Сообщение: pg_ctl updated
Следующее
От: wieck@debis.com (Jan Wieck)
Дата:
Сообщение: TOAST project page