Re: Change definitions of bitmap flags to bit-shifting style

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Change definitions of bitmap flags to bit-shifting style
Дата
Msg-id 2303329.1607191423@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Change definitions of bitmap flags to bit-shifting style  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Ответы Re: Change definitions of bitmap flags to bit-shifting style  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Re: Change definitions of bitmap flags to bit-shifting style  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-hackers
Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> The attached patch changes definitions like
>      #define FOO 0x01
>      #define BAR 0x02
> to
>      #define FOO (1 << 0)
>      #define BAR (1 << 1)
> etc.

> Both styles are currently in use, but the latter style seems more 
> readable and easier to update.

FWIW, personally I'd vote for doing the exact opposite.  When you are
debugging and examining the contents of a bitmask variable, it's easier to
correlate a value like "0x03" with definitions made in the former style.
Or at least I think so; maybe others see it differently.

            regards, tom lane



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

Предыдущее
От: Dmitry Dolgov
Дата:
Сообщение: Re: Index Skip Scan (new UniqueKeys)
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: [PATCH] Keeps tracking the uniqueness with UniqueKey