Re: A minor correction in comment in heaptuple.c

From: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A minor correction in comment in heaptuple.c
Date: 2013-06-18 09:21:15
Message-ID: 20130618052115.4c642841@imp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 18 Jun 2013 11:01:28 +0200
Andres Freund <andres(at)2ndquadrant(dot)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?

--
D'Arcy J.M. Cain <darcy(at)druid(dot)net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 788 2246 (DoD#0082) (eNTP) | what's for dinner.
IM: darcy(at)Vex(dot)Net, VOIP: sip:darcy(at)Vex(dot)Net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Markus Wanner 2013-06-18 09:25:59 Re: Change authentication error message (patch)
Previous Message Amit Langote 2013-06-18 09:06:35 Re: A minor correction in comment in heaptuple.c