Re: Missed compiler optimization issue in function select_rtable_names_for_explain

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: XChy <xxs_chy(at)outlook(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Missed compiler optimization issue in function select_rtable_names_for_explain
Date: 2024-05-22 18:14:10
Message-ID: 211F711D-A799-489B-B0BE-10CBEFC51424@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On 22 May 2024, at 18:53, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
>> They are known to be zero, but that's not entirely equivalent though is it?
>> NIL is defined as ((List *) NULL) and NULL is typically defined as ((void *)
>> 0), so sizeof(0) would be the size of an int and sizeof(NULL) would be the size
>> of a void pointer.
>
> There are other places where we assume that a memset-to-zero will
> produce null pointers, so I don't think that that objection has
> a lot of force.

It wasn't really an objection, but (perhaps a badly worded) an attempt to
understand the proposal.

> My real answer is that this is our coding style
> and we are not going to change it: our normal convention is to
> initialize struct fields in declaration order, and that's what
> we're doing here. If some particular version of some particular
> compiler fails to make an entirely-negligible optimization in
> consequence, that is not something we are going to care about.

+1

--
Daniel Gustafsson

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2024-05-22 19:12:50 Re: search_path wildcard?
Previous Message Daniel Gustafsson 2024-05-22 18:12:36 Re: Missed compiler optimization issue in function select_rtable_names_for_explain