Re: Run pgindent now?

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Run pgindent now?
Дата
Msg-id 55650EF4.9040300@gmx.net
обсуждение исходный текст
Ответ на Re: Run pgindent now?  (Andres Freund <andres@anarazel.de>)
Ответы Re: Run pgindent now?  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On 5/25/15 7:15 PM, Andres Freund wrote:
> On 2015-05-25 19:01:28 -0400, Bruce Momjian wrote:
>>> A longer-term fix would be to make pgindent less stupid about this sort
>>> of usage, but nobody's yet volunteered to dig into the guts of that code.
>>
>> I assume a typedefs list is going to be a requirement of any decent C
>> indenting tool.
> 
> Maybe I'm missing something major here, but why? Afaict it's just only
> used for formatting decisions that could be made without it just as well?

AFAICT, the main reason is to decide whether * and & are binary infix or
unary prefix operators.  Otherwise, it wouldn't know whether to write
   char * foo;

or the more customary
   char *foo;

Now, running pgindent without a typedefs list also makes it do things like
static int32
-makepol(QPRS_STATE *state)
+makepol(QPRS_STATE * state)

which, one might argue, it could figure out without a typedefs list.
But then the formatting would be inconsistent between prototypes and
variable declarations, which might drive people crazy.  I don't know
whether there is a better way than living with it, one way or the other
(i.e., requiring a types list, or accepting slightly odd formatting).




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

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: optimizing vacuum truncation scans
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Run pgindent now?