Re: Consistently use palloc_object() and palloc_array()
| От | Tom Lane |
|---|---|
| Тема | Re: Consistently use palloc_object() and palloc_array() |
| Дата | |
| Msg-id | 32295.1764213912@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: Consistently use palloc_object() and palloc_array() (Thomas Munro <thomas.munro@gmail.com>) |
| Ответы |
Re: Consistently use palloc_object() and palloc_array()
|
| Список | pgsql-hackers |
Thomas Munro <thomas.munro@gmail.com> writes:
> This isn't a fully-baked thought, just a thought that occurred to me
> while looking into that: If palloc_object(Int128AggState) were smart
> enough to detect that alignof(T) > MAXALIGN and redirect to
> palloc_aligned(sizeof(T), alignof(T), ...) at compile time, then
> Int128AggState would naturally propagate the layout requirements of
> its __int128 member, and we wouldn't need to do that weird stuff, and
> it wouldn't be error-prone if usage of __int128 spreads to more
> structs. That really only makes sense if we generalise
> palloc_object() as a programming style and consider direct use of
> palloc() to be a rarer low-level interface that triggers human
> reviewers to think about alignment, I guess.
Hmm ... I had the same doubts as Michael about whether this change
could possibly be worth the ensuing back-patching pain. But if
it leads to an improvement in type-safety, that'd be a reason to
take on the work.
regards, tom lane
В списке pgsql-hackers по дате отправления: