Re: Improve readability by using designated initializers when possible

From: Japin Li <japinli(at)hotmail(dot)com>
To: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, jian he <jian(dot)universality(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Improve readability by using designated initializers when possible
Date: 2024-03-05 14:30:34
Message-ID: ME3P282MB3166094509182D817151A722B6222@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Tue, 05 Mar 2024 at 22:03, Jelte Fennema-Nio <postgres(at)jeltef(dot)nl> wrote:
> On Tue, 5 Mar 2024 at 14:50, Japin Li <japinli(at)hotmail(dot)com> wrote:
>> Attach a patch to rewrite dispatch_table array using C99-designated
>> initializer syntax.
>
> Looks good. Two small things:

Thanks for the review.

>
> + [EEOP_LAST] = &&CASE_EEOP_LAST,
>
> Is EEOP_LAST actually needed in this array? It seems unused afaict. If
> indeed not needed, that would be good to remove in an additional
> commit.

There is a warning if remove it, so I keep it.

/home/japin/Codes/postgres/build/../src/backend/executor/execExprInterp.c:118:33: warning: label ‘CASE_EEOP_LAST’ defined but not used [-Wunused-label]
118 | #define EEO_CASE(name) CASE_##name:
| ^~~~~
/home/japin/Codes/postgres/build/../src/backend/executor/execExprInterp.c:1845:17: note: in expansion of macro ‘EEO_CASE’
1845 | EEO_CASE(EEOP_LAST)
| ^~~~~~~~

>
> - *
> - * The order of entries needs to be kept in sync with the dispatch_table[]
> - * array in execExprInterp.c:ExecInterpExpr().
>
> I think it would be good to at least keep the comment saying that this
> array should be updated (only the order doesn't need to be strictly
> kept in sync anymore).

Fixed.

Attachment Content-Type Size
v2-0001-Use-C99-designated-initializer-syntax-for-dispatc.patch text/x-diff 9.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2024-03-05 14:58:10 Re: Dump-restore loosing 'attnotnull' bit for DEFERRABLE PRIMARY KEY column(s).
Previous Message Давыдов Виталий 2024-03-05 14:29:32 Re: Slow catchup of 2PC (twophase) transactions on replica in LR