Re: GinPageIs* don't actually return a boolean - Mailing list pgsql-hackers

From Andres Freund
Subject Re: GinPageIs* don't actually return a boolean
Date
Msg-id 64ACF6AC-89CC-4C29-8DF2-62E2E04714E3@anarazel.de
Whole thread Raw
In response to Re: GinPageIs* don't actually return a boolean  (Teodor Sigaev <teodor@sigaev.ru>)
Responses Re: GinPageIs* don't actually return a boolean
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: GinPageIs* don't actually return a boolean
Next
From: Pavel Stehule
Date:
Subject: Re: [COMMITTERS] pgsql: Code cleanup in the wake of recent LWLock refactoring.