Re: CompactCheckpointerRequestQueue versus pad bytes - Mailing list pgsql-hackers

From Tom Lane
Subject Re: CompactCheckpointerRequestQueue versus pad bytes
Date
Msg-id 11802.1342456020@sss.pgh.pa.us
Whole thread Raw
In response to Re: CompactCheckpointerRequestQueue versus pad bytes  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: CompactCheckpointerRequestQueue versus pad bytes
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> The documentation on MacOS X isn't quite as explicit, but I'd still be
> astonished if we found any other behavior.  TBH, I'd be kind of
> surprised if this is the only place in our code base that relies on
> the initial contents of shared memory being all-zeros.

Maybe so, but if we find any others, I'll be wanting to change them too.
It's bad practice and worse documentation for modules to be silently
assuming that anything has a value they didn't explicitly give it.

A related practice that probably costs us a lot more, in both code space
and time, is that most (all?) places that create Node objects explicitly
initialize every field of the Node struct, even though makeNode() has
a palloc0 underneath it and so setting fields to zero is redundant.
I believe that this is a good practice anyway, for documentation and
code greppability reasons.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [PERFORM] DELETE vs TRUNCATE explanation
Next
From: Tom Lane
Date:
Subject: Re: [PERFORM] DELETE vs TRUNCATE explanation