Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays
Дата
Msg-id 13800.1570162088@sss.pgh.pa.us
обсуждение исходный текст
Ответ на RE: Proposal: Make use of C99 designated initialisers fornulls/values arrays  ("Smith, Peter" <peters@fast.au.fujitsu.com>)
Ответы RE: Proposal: Make use of C99 designated initialisers fornulls/values arrays  ("Smith, Peter" <peters@fast.au.fujitsu.com>)
Список pgsql-hackers
"Smith, Peter" <peters@fast.au.fujitsu.com> writes:
> From: Amit Kapila <amit.kapila16@gmail.com> Sent: Friday, 4 October 2019 1:32 PM
>>   Also, if we want to pursue, do we want to use INIT_ALL_ZEROES for bool arrays as well?

> FYI - In case it went unnoticed - my last patch addresses this by defining 2 macros:

> #define INIT_ALL_ELEMS_ZERO    {0}
> #define INIT_ALL_ELEMS_FALSE    {false}

I would say that's 100% wrong.  The entire point here is that it's
memset-equivalent, and therefore writes zeroes, regardless of what
the datatype is.  As a counterexample, the coding you have above
looks a lot like it would work to add

#define INIT_ALL_ELEMS_TRUE    {true}

which as previously noted will *not* work.  So I think the
one-size-fits-all approach is what to use.

            regards, tom lane



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

Предыдущее
От: "Smith, Peter"
Дата:
Сообщение: RE: Proposal: Make use of C99 designated initialisers fornulls/values arrays
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: [HACKERS] proposal: schema variables