Re: A minor correction in comment in heaptuple.c

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: A minor correction in comment in heaptuple.c
Дата
Msg-id 20130618093845.GD5646@awork2.anarazel.de
обсуждение исходный текст
Ответ на Re: A minor correction in comment in heaptuple.c  ("D'Arcy J.M. Cain" <darcy@druid.net>)
Ответы Re: A minor correction in comment in heaptuple.c  (Kevin Grittner <kgrittn@ymail.com>)
Re: A minor correction in comment in heaptuple.c  ("D'Arcy J.M. Cain" <darcy@druid.net>)
Список pgsql-hackers
On 2013-06-18 05:21:15 -0400, D'Arcy J.M. Cain wrote:
> On Tue, 18 Jun 2013 11:01:28 +0200
> Andres Freund <andres@2ndquadrant.com> wrote:
> > > /*
> > >  * return true if attnum is out of range according to the tupdesc
> > > */
> > > if (attnum > tupleDesc->natts)
> > > return true;
> > 
> > I think the comment is more meaningfull before the change since it
> > tells us how nonexisting columns are interpreted.
> 
> I think that the comment is bad either way.  Comments should explain
> the code, not repeat it.  The above is not far removed from...
> 
>   return 5; /* return the number 5 */
> 
> How about "check if attnum is out of range according to the tupdesc"
> instead?

I can't follow. Minus the word 'NULL' - which carries meaning - your
suggested comment pretty much is the same as the existing comment except
that you use 'check' instead of 'return'.

Original:/* * return NULL if attnum is out of range according to the tupdesc */if (attnum > tupleDesc->natts)    return
true;


Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Support for REINDEX CONCURRENTLY
Следующее
От: Boszormenyi Zoltan
Дата:
Сообщение: Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])