Re: plenty code is confused about function level static

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Peter Eisentraut <peter(at)eisentraut(dot)org>, "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
Subject: Re: plenty code is confused about function level static
Date: 2024-07-02 11:49:30
Message-ID: CAEudQApyGcaywrbWVJsZxYOK+u2dVt4xHBy4YaPtwy6rqSH-VA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em qui., 18 de abr. de 2024 às 14:43, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
escreveu:

>
>
> Em qui., 18 de abr. de 2024 às 14:16, Andres Freund <andres(at)anarazel(dot)de>
> escreveu:
>
>> Hi,
>>
>> On 2024-04-18 09:07:43 -0300, Ranier Vilela wrote:
>> > On 18/04/2024 00:39, Andres Freund wrote:
>> > >There are lots of places that could benefit from adding 'static
>> > >const'.
>> >
>> > I found a few more places.
>>
>> Good catches.
>>
>>
>> > Patch 004
>> >
>> > The opposite would also help, adding static.
>> > In these places, I believe it is safe to add static,
>> > allowing the compiler to transform into read-only, definitively.
>>
>> I don't think this would even compile?
>
> Compile, at least with msvc 2022.
> Pass ninja test.
>
>
> E.g. LockTagTypeNames, pg_wchar_table
>> are declared in a header and used across translation units.
>>
> Sad.
> There should be a way to export a read-only (static const) variable.
> Better remove these.
>
> v1-0005 attached.
>
Now with v18 open, any plans to forward this?

best regards,
Ranier Vilela

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2024-07-02 11:55:49 Re: LogwrtResult contended spinlock
Previous Message Dean Rasheed 2024-07-02 11:44:18 Re: Optimize numeric multiplication for one and two base-NBASE digit multiplicands.