Closed N-Dekker closed 6 months ago
/azp run
I find the member function name over verbose.
AllocateInitialized
for the name? Docstring should have sufficient explanation about default values.
AllocateInitialized
for the name?
Thanks for the suggestion @dzenanz. However, I would like the name to be self-explanatory. Until now it was a common practice to add a comment to actually explain the meaning of Allocate(true)
with each Allocate(true)
call. For example:
m_TemporaryPointer->Allocate(true); // initialize buffer to zero
So do you (both) think the name AllocateInitialized
is sufficiently self-explanatory? So that most people won't feel the need to look up the meaning, or add a comment like "initialize buffer to zero"?
So do you (both) think the name
AllocateInitialized
is sufficiently self-explanatory? So that most people won't feel the need to look up the meaning, or add a comment like "initialize buffer to zero"?
I think the name is sufficient 👍
The existing three possible ways to call
Allocate(bool = false)
(either byAllocate(true)
,Allocate(false)
, orAllocate()
) may accidentally be confused, especially by novice ITK users.The proposed
AllocateZeroInitializedPixelBuffer()
is intended to reduce the chance of such a confusion, and improve code readability. It is equivalent toAllocate(true)
.For the record, "AllocateZeroInitializedPixelBuffer" was renamed to "AllocateInitialized", as suggested at https://github.com/InsightSoftwareConsortium/ITK/pull/4479#issuecomment-1964624698