Re: POC: converting Lists into arrays - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: POC: converting Lists into arrays
Date
Msg-id CAMsr+YGTrK023TUkCMj9pBeX0eyrdMO0D9=SBAQ0B4t3-8R8-Q@mail.gmail.com
Whole thread Raw
In response to Re: POC: converting Lists into arrays  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: POC: converting Lists into arrays  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Thu, 1 Aug 2019 at 07:40, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Andres Freund <andres@anarazel.de> writes:
> Unfortunately foreach(ListCell *lc, ...) doesn't work with the current
> definition. Which I think isn't great, because the large scopes for loop
> iteration variables imo makes the code harder to reason about.


Totally agree.
 

you can only put one <declaration> into the first element of a
for (;;).

Use an anonymous block outer scope? Or if not permitted even by C99 (which I think it is), a do {...} while (0);  hack?


--
 Craig Ringer                   http://www.2ndQuadrant.com/
 2ndQuadrant - PostgreSQL Solutions for the Enterprise

pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: Small patch to fix build on Windows
Next
From: Craig Ringer
Date:
Subject: Re: Proposal for Signal Detection Refactoring