Re: alignas (C11)

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: alignas (C11)
Дата
Msg-id eb9a1132-0144-4b04-848b-6f919fd0b189@eisentraut.org
обсуждение исходный текст
Ответ на Re: alignas (C11)  (Thomas Munro <thomas.munro@gmail.com>)
Список pgsql-hackers
On 12.11.25 15:17, Thomas Munro wrote:
> In a very quick hack (so probably missing things) I also seemed to be
> able to get rid of all our ALIGNOF_ configure probes and just write
> alignof(int) when I want the alignment of int,

According to my research, using alignof could be quite dangerous for our 
use, because it does not necessarily match what the ALIGNOF_ probes 
return.  The latter just answer the question, what is the offset if I 
stick this in a struct as the second field, but that could be larger 
than the smallest valid alignment for a type.  And there are 
platforms/ABIs where they are actually different.

If we didn't have to worry about on-disk compatibility, then using 
alignof would in theory be better, because if the minimal alignment is 
actually smaller than the current configure probes compute, then we 
could save storage.  But for the system catalog structs we actually do 
want the offset-in-struct interpretation, so we're tied to that anyway.

(Also, something about AIX here ... :-/)

So, I don't know, better be careful with this ...

> move the MAXALIGN
> derivation into about two lines of c.h,

Yes, I had also arrived at that.  Just to unify some configure and meson 
code.




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