On 2018-Aug-30, Mark Dilger wrote:
> static struct config_bool ConfigureNamesBool[] =
> {
> {
> {"enable_seqscan", PGC_USERSET, QUERY_TUNING_METHOD,
> gettext_noop("Enables the planner's use of sequential-scan plans."),
> NULL
> },
> &enable_seqscan,
> true,
> NULL, NULL, NULL
> },
Personally, I dislike this form -- it's very opaque and I have to refer
to the struct definition each time I want to add a new member, to make
sure I'm assigning the right thing. I welcome designated initializers
in this case even though it becomes more verbose. I don't think
explicitly initializing to NULLs is sensible in this case; let's just
omit those fields.
> What should the general rule be for initializing arrays of structs such as these?
I don't know what a general rule would be. Maybe we can try hand-
inspecting a few cases, and come up with a general rule once we acquire
sufficient experience.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services