From: Petr Jelinek <petr@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: POC: converting Lists into arrays
Date: Thu, 1 Aug 2019 01:17:37 +0200
Message-ID: <c84fc37c-2e27-736f-ce4f-694e6c9c80e8@2ndquadrant.com> (raw)
In-Reply-To: <20190731230403.ytizwaji7gvof7x3@alap3.anarazel.de>
References: <11587.1550975080@sss.pgh.pa.us>
<20190731225756.nozn3j6lgwhm6qvq@alap3.anarazel.de>
<20190731230047.xtbgswuwopmrhd53@alap3.anarazel.de>
<20190731230403.ytizwaji7gvof7x3@alap3.anarazel.de>
On 01/08/2019 01:04, Andres Freund wrote:
> Hi,
>
> On 2019-07-31 16:00:47 -0700, Andres Freund wrote:
>> On 2019-07-31 15:57:56 -0700, Andres Freund wrote:
>>> I also wonder if a foreach version that includes the typical
>>> (Type *) var = (Type *) lfirst(lc);
>>> or
>>> (Type *) var = castNode(Type, lfirst(lc));
>>> or
>>> OpExpr *hclause = lfirst_node(OpExpr, lc);
>>>
>>> would make it nicer to use lists.
>>>
>>> foreach_node_in(Type, name, list) could mean something like
>>>
>>> foreach(ListCell *name##_cell, list)
>>> {
>>> Type* name = lfirst_node(Type, name##_cell);
>>> }
>>
>> s/lfirst/linitial/ of course. Was looking at code that also used
>> lfirst...
>
> Bullshit, of course.
>
> /me performs a tactical withdrawal into his brown paper bag.
>
>
>> Reminds me that one advantage of macros like the second one would also
>> be to reduce the use of the confusingly named linitial*(), helping newer
>> hackers.
>
> But that point just had two consecutive embarassing demonstrations...
>
Yeah, pg_list.h is one file I never close.
--
Petr Jelinek
2ndQuadrant - PostgreSQL Solutions for the Enterprise
https://www.2ndQuadrant.com/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: petr@2ndquadrant.com, andres@anarazel.de, tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org
Subject: Re: POC: converting Lists into arrays
In-Reply-To: <c84fc37c-2e27-736f-ce4f-694e6c9c80e8@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox