Skip to content

trivial designated initializers #126

@grantzhou

Description

@grantzhou

--- As of 2026-01-29T00:04:16.000Z ---

Álvaro Herrera proposes converting two PostgreSQL arrays to use C99 designated struct initializers: the tupleLockExtraInfo array in heapam.c and InternalBGWorkers array in bgworker.c. This would make the code more consistent with other parts of PostgreSQL that already use designated initializers. Melanie Plageman and Jelte Fennema-Nio both express support for the change, finding designated initializers easier to understand and generally preferring them. Peter Eisentraut also supports the idea but suggests further improvements, including using array index designators and consolidating repetitive comments. He recommends moving explanatory comments to the struct field declaration rather than repeating them for each array element. The proposal appears to have unanimous support with constructive suggestions for enhancement.

Álvaro Herrera提议将PostgreSQL中的两个数组转换为使用C99指定结构体初始化器:heapam.c中的tupleLockExtraInfo数组和bgworker.c中的InternalBGWorkers数组。这将使代码与PostgreSQL中已经使用指定初始化器的其他部分保持一致。Melanie Plageman和Jelte Fennema-Nio都表示支持这一变更,认为指定初始化器更易于理解且通常更喜欢使用它们。Peter Eisentraut也支持这个想法,但建议进一步改进,包括使用数组索引指定符和整合重复的注释。他建议将解释性注释移到结构体字段声明处,而不是为每个数组元素重复注释。该提议似乎获得了一致支持,并有建设性的增强建议。

participants - 参与者:

Metadata

Metadata

Assignees

No one assigned

    Labels

    hacker discussionshacker discussions summarized by PGNexus Agent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions