Re: Boatload of warnings in CVS HEAD :-(

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Boatload of warnings in CVS HEAD :-(
Date: 2007-05-04 14:31:08
Message-ID: 20070504143108.GB12748@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Martijn van Oosterhout wrote:
> On Fri, May 04, 2007 at 02:18:31PM +0200, Zdenek Kotala wrote:
> > Is the reason for keeping this in a code? Another kind of construct is:
> >
> > #define PG_RETURN_NULL() \
> > do { fcinfo->isnull = true; return (Datum) 0; } while (0)
>
> This is a standard way of getting multiple statements into a macro. If
> the compiler complains, too bad, there isn't a standard alternative.

So it is standard by it's not standard ;-)

> > or
> > why is there while ... break instead if?
> > http://doxygen.postgresql.org/comment_8c-source.html#l00221
>
> Not sure about this one. It's not wrong, but it is unusual. Maybe
> someone wanted to make it so that in the future it would handle
> multiple cases?

There are many other cases where we do it cleanly, without the while
loop. I don't see any reason to not do this one the same way.

- while ((oldtuple = systable_getnext(sd)) != NULL)
+ oldtuple = systable_getnext(sd);
+ if (HeapTupleIsValid(oldtuple))
...
- break;

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 2007-05-04 15:59:05 Re: psqlodbc - psqlodbc: Put Autotools-generated files into subdirectory
Previous Message Tom Lane 2007-05-04 14:04:08 Re: pgsql: Teach tuplesort.c about "top N" sorting, in which only the first