On Fri, Oct 4, 2019 at 12:10 PM Smith, Peter <pet...@fast.au.fujitsu.com> wrote:
> From: Tom Lane <t...@sss.pgh.pa.us> Sent: Friday, 4 October 2019 2:08 PM > > >> #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. > > I agree it is memset-equivalent. > > All examples of the memset code that INIT_ALL_ELEMS_ZERO replaces looked > like this: > memset(values, 0, sizeof(values)); > > Most examples of the memset code that INIT_ALL_ELEMS_FALSE replaces looked > like this: > memset(nulls, false, sizeof(nulls)); > > ~ > > I made the 2nd macro because I anticipate the same folk that don't like > setting 0 to a bool will also not like setting something called > INIT_ALL_ELEMS_ZERO to a bool array. > > How about I just define them both the same? > #define INIT_ALL_ELEMS_ZERO {0} > #define INIT_ALL_ELEMS_FALSE {0} > > I think using one define would be preferred, but you can wait and see if others prefer defining different macros for the same thing. -- With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com