Re: [PATCH] Make various variables read-only (const)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] Make various variables read-only (const)
Дата
Msg-id 5325.1390076784@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCH] Make various variables read-only (const)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I wrote:
> AFAICT, this change and some similar ones are based on a false assumption.
> It is *not* necessary to replace pointers by fixed-length arrays in order
> to get things into .rodata.

After further experimentation I find that this claim is true when
compiling "normally", but apparently not when using -fpic, at least
not on RHEL6 x86_64.  Even when const-ified, the tables in encnames.o
and wchar.o end up in the data segment (though the underlying strings
are not).  So if we want a meaningful shrinkage in the size of the data
segment in libpq.so, we'd have to do something similar to what Oskari
proposes.

However, I'm still against doing so; the other points I made before
still apply, and I think on balance fixed-length arrays are still a
bad idea.  It seems like a particularly bad idea to expose a limit
on the length of an encoding name as part of the ABI defined by
pg_wchar.h, as the submitted patch did.  I'm on board with making
changes like this where they can be argued to improve correctness and
maintainability, but surely moving to fixed-length arrays is the
opposite of that.
        regards, tom lane



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

Предыдущее
От: Marti Raudsepp
Дата:
Сообщение: Re: PoC: Partial sort
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: new json funcs