Re: Remove redundant initializations
| От | Tom Lane |
|---|---|
| Тема | Re: Remove redundant initializations |
| Дата | |
| Msg-id | 153226.1624889723@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Remove redundant initializations (Peter Eisentraut <peter.eisentraut@enterprisedb.com>) |
| Ответы |
Re: Remove redundant initializations
|
| Список | pgsql-hackers |
Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> There are certain parts of code that laboriously initialize every field
> of a struct to (some spelling of) zero, even though the whole struct was
> just zeroed (by makeNode() or memset()) a few lines earlier.
FWIW, I think that it's an intentional style choice to explicitly
initialize every field rather than relying on makeNode to have done so.
The primary case where I personally rely on that style is when adding a
new field to a struct. Currently it's possible to grep for some existing
field and add the new one beside it. Leaving out initializations by
relying on side-effects of makeNode makes that far riskier.
A different aspect is the one you mention parenthetically, which is
what values can we rely on to be all-zero-bits? Switching to this
style will embed assumptions about that to a far greater degree than
we have now, making the code less robust against changes.
I'm aware that there are opinions to the contrary, but I do not think
this is an improvement.
regards, tom lane
В списке pgsql-hackers по дате отправления: