Re: PgStat_HashKey padding issue when passed by reference
От | Sami Imseih |
---|---|
Тема | Re: PgStat_HashKey padding issue when passed by reference |
Дата | |
Msg-id | CAA5RZ0saO_DfAxUFD_QSm804+Sm_-t+Sq67ESXq_q__eQgG9vw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: PgStat_HashKey padding issue when passed by reference (Michael Paquier <michael@paquier.xyz>) |
Ответы |
Re: PgStat_HashKey padding issue when passed by reference
|
Список | pgsql-hackers |
> More suggestions or a better sentence are of course welcome. > "NB: We assume that this struct contains no padding. The 8 bytes > allocated for the object ID are good enough to ensure the uniqueness > of the hash key, hence the addition of new fields is not recommended." That sounds correct. However, I see the no padding and the objid as separate points. One could add a new field that does not introduce padding. So, I added "Also, " for clarity. "NB: We assume that this struct contains no padding. Also, 8 bytes allocated for the object ID are good enough to ensure the uniqueness of the hash key, hence the addition of new fields is not recommended." Also, what about we also add the assert as done earlier in this thread [0] to ensure that the struct indeed does not have padding? +/* + * PgStat_HashKey should not have any padding. Checking that the structure + * size matches with the sum of each field is a check simple enough to + * enforce this policy. + */ +StaticAssertDecl((sizeof(PgStat_Kind) + sizeof(uint64) + sizeof(Oid)) == + sizeof(PgStat_HashKey), + "PgStat_HashKey should have no padding"); + [0] https://www.postgresql.org/message-id/aL9zo5X0MsSxO2pM%40paquier.xyz -- Sami
В списке pgsql-hackers по дате отправления: