Bruce Momjian <br...@momjian.us> writes:
>>> On Tue, Oct 1, 2019 at 1:25 PM Smith, Peter <pet...@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


Reply via email to