Re: [HACKERS] taking stdbool.h into use

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [HACKERS] taking stdbool.h into use
Дата
Msg-id CAB7nPqT_Gx6zUhBjhJZAN2GVt6nBx2yqXr3TGWfcMkFuinUj1Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] taking stdbool.h into use  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: [HACKERS] taking stdbool.h into use  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
On Thu, Dec 21, 2017 at 1:02 AM, Peter Eisentraut
<peter.eisentraut@2ndquadrant.com> wrote:
> On 11/15/17 15:13, Peter Eisentraut wrote:
>> I'm going to put this patch set as Returned With Feedback for now.  The
>> GinNullCategory issues look like they will need quite a bit of work.
>> But it will be worth picking this up some time.
>
> I think the issue with GinNullCategory is practically unfixable.  This
> is on-disk data that needs to be castable to an array of bool.  So
> tolerating a bool of size other than 1 would either require a disk
> format change or extensive code changes, neither of which seem
> worthwhile at this point.
>
> So here is a minimal patch set to perhaps wrap this up for the time
> being.  I have added static assertions that check the sizes of
> GinNullCategory and GinTernaryValue, which I think are the two critical
> places that require compatibility with bool.  And then we include
> <stdbool.h> only if its bool has size 1.

+   /*
+    * now we can use the nullFlags as category codes
+    */
+   StaticAssertStmt(sizeof(GinNullCategory) == sizeof(bool),
+                    "sizes of GinNullCategory and bool are not equal");
    *categories = (GinNullCategory *) nullFlags;

Hm. So on powerpc compilation is going to fail with this patch as
sizeof(char) is 1, no? Wouldn't it be better to just allocate an array
for GinNullCategory entries and then just fill in the values one by
one with GIN_CAT_NORM_KEY or GIN_CAT_NULL_KEY by scanning nullFlags?
-- 
Michael


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

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: [HACKERS] Proposal: Local indexes for partitioned table
Следующее
От: Konstantin Knizhnik
Дата:
Сообщение: Re: AS OF queries