Re: Remove unnecessary static type qualifiers

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Junwang Zhao <zhjwpku(at)gmail(dot)com>
Cc: Japin Li <japinli(at)hotmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Remove unnecessary static type qualifiers
Date: 2025-04-08 14:13:35
Message-ID: 3977290.1744121615@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Junwang Zhao <zhjwpku(at)gmail(dot)com> writes:
> On Tue, Apr 8, 2025 at 4:29 PM Japin Li <japinli(at)hotmail(dot)com> wrote:
>> - static const char query[] = "set client_encoding to '%s'";
>> + const char query[] = "set client_encoding to '%s'";

> I doubt that, if you remove the *static*, it will allocate more memory
> on stack and need more instructions to copy the string to that area.

Yeah, it's not an improvement as written. This might be OK:

>> + const char *query = "set client_encoding to '%s'";

But I kinda doubt it's worth touching.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-04-08 14:17:58 Re: prevent 006_transfer_modes.pl from leaving files behind
Previous Message Dean Rasheed 2025-04-08 14:12:14 Re: Some problems regarding the self-join elimination code