| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | Mark Dilger <hornschnorter(at)gmail(dot)com> | 
| Cc: | Joe Nelson <joe(at)begriffs(dot)com>, Isaac Morland <isaac(dot)morland(at)gmail(dot)com>, "Smith, Peter" <peters(at)fast(dot)au(dot)fujitsu(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays | 
| Date: | 2019-10-02 18:02:33 | 
| Message-ID: | 13532.1570039353@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Mark Dilger <hornschnorter(at)gmail(dot)com> writes:
> On 10/2/19 8:46 AM, Tom Lane wrote:
>> Right.  I think that in general it's bad practice for an initializer
>> to not specify all fields/elements of the target.
> There are numerous locations in the code that raise warnings when
> -Wmissing-field-initializers is handed to gcc.  See, for example, 
> src/backend/utils/adt/formatting.c where
>    static const KeyWord NUM_keywords[]
> is initialized, and the code comment above that disclaims the need to 
> initialize is_digit and date_mode.  Are you proposing cleaning up all 
> such incomplete initializations within the project?
Hmm.  Maybe it's worth doing as a code beautification effort, but
I'm not volunteering.  At the same time, I wouldn't like to make a
change like this, if it introduces dozens/hundreds of new cases.
> I understand that your INIT_ALL_ZEROS macro does nothing to change
> whether -Wmissing-field-initializers would raise a warning.
Not sure --- the name of that option suggests that maybe it only
complains about omitted *struct fields* not omitted *array elements*.
If it does complain, is there any way that we could extend the macro
to annotate usages of it to suppress the warning?
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2019-10-02 18:30:08 | Re: WIP: Generic functions for Node types using generated metadata | 
| Previous Message | Tom Lane | 2019-10-02 17:51:43 | Re: Hooks for session start and end, take two |