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 4147.1569946628@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Proposal: Make use of C99 designated initialisers fornulls/values arrays  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: Proposal: Make use of C99 designated initialisers fornulls/values arrays  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Bruce Momjian <bruce@momjian.us> writes:
>>> On Tue, Oct 1, 2019 at 1:25 PM Smith, Peter <peters@fast.au.fujitsu.com> wrote:
>>>> There are lots of tuple operations where arrays of values and flags are being passed.
>>>> Typically these arrays are being previously initialised 0/false by memset.
>>>> By modifying code to use C99 designated initialiser syntax [1], most of these memsets can become redundant.

> I like it!

FYI, I checked into whether this would result in worse generated code.
In the one place I checked (InsertPgAttributeTuple, which hopefully
is representative), I got *exactly the same* assembly code before
and after, on both a somewhat-aging gcc and fairly modern clang.
Hadn't quite expected that, but it removes any worries about whether
we might be losing anything.

Note though that InsertPgAttributeTuple uses memset(), while some of
these other places use MemSet().  The code I see being generated for
MemSet() is also the same(!) on clang, but it is different and
probably worse on gcc.  I wonder if it isn't time to kick MemSet to
the curb.  We have not re-evaluated that macro in more than a dozen
years, and compilers have surely changed.

            regards, tom lane



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

Предыдущее
От: "REIX, Tony"
Дата:
Сообщение: RE: Shared Memory: How to use SYSV rather than MMAP ?
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Value of Transparent Data Encryption (TDE)