Re: GinPageIs* don't actually return a boolean

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: GinPageIs* don't actually return a boolean
Дата
Msg-id 64ACF6AC-89CC-4C29-8DF2-62E2E04714E3@anarazel.de
обсуждение исходный текст
Ответ на Re: GinPageIs* don't actually return a boolean  (Teodor Sigaev <teodor@sigaev.ru>)
Ответы Re: GinPageIs* don't actually return a boolean  (Yury Zhuravlev <u.zhuravlev@postgrespro.ru>)
Список pgsql-hackers
On February 12, 2016 5:15:59 PM GMT+01:00, Teodor Sigaev <teodor@sigaev.ru> wrote:
>One more option for patch:
>
>#define GinPageIsLeaf(page)    ((bool)(GinPageGetOpaque(page)->flags &
>GIN_LEAF))
>
>Seems it will work on any platform with built-in bool. But I don't know
>will it 
>work with 'typedef char bool' if high bit will be set.

Unless I am missing something major, that doesn't seem to achieve all that much. A cast to a char based bool wouldn't
normalizethis to 0 or 1. So you're still not guaranteed to be able to do somebool == anotherbool when either are set
basedon such a macro.
 

Andres

--- 
Please excuse brevity and formatting - I am writing this on my mobile phone.



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: GinPageIs* don't actually return a boolean
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Code cleanup in the wake of recent LWLock refactoring.