Re: plenty code is confused about function level static

Поиск
Список
Период
Сортировка
От Ranier Vilela
Тема Re: plenty code is confused about function level static
Дата
Msg-id CAEudQAqzQgVc9O50g4ZnJzRS5ugqpS07DzSM5ZBa3HUvtswqMQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: plenty code is confused about function level static  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers


Em qui., 18 de abr. de 2024 às 14:16, Andres Freund <andres@anarazel.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.

best regards,
Ranier Vilela
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: plenty code is confused about function level static
Следующее
От: Andres Freund
Дата:
Сообщение: Re: fix tablespace handling in pg_combinebackup