Re: XID formatting and SLRU refactorings

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: XID formatting and SLRU refactorings
Дата
Msg-id 993503.1647570585@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: XID formatting and SLRU refactorings  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Список pgsql-hackers
Kyotaro Horiguchi <horikyota.ntt@gmail.com> writes:
> At Thu, 17 Mar 2022 19:25:00 +0300, Maxim Orlov <orlovmg@gmail.com> wrote in
>> +/* printf/elog format compatible with 32 and 64 bit xid. */
>> +typedef unsigned long long        XID_TYPE;
>> ...
>> +     errmsg_internal("found multixact %llu from before relminmxid %llu",
>> +             (XID_TYPE) multi, (XID_TYPE) relminmxid)));

> "(XID_TYPE) x" is actually equivalent to "(long long) x" here, but the
> point here is "%llu in format string accepts (long long)" so we should
> use literally (or bare) (long long) and the maybe-all precedents does
> that.

Yes.  Please do NOT do it like that.  Write (long long), not something
else, to cast a value to match an "ll" format specifier.  Otherwise
you're just making readers wonder whether your code is correct.

            regards, tom lane



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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: Proposal: Support custom authentication methods using hooks
Следующее
От: Mark Dilger
Дата:
Сообщение: New Object Access Type hooks