From: Junio C Hamano Date: Tue, 10 Mar 2020 18:19:33 GMT Subject: Re: [PATCH] commit-slab: clarify slabname##_peek()'s return value Message-ID: In-Reply-To: <20200310175446.GB549010@coredump.intra.peff.net> Jeff King writes: > But that would get a bit awkward, because peek() returns a pointer, not > a value (as it should, because the type we're storing may be a compound > type, which we generally avoid passing or returning by value). So we'd > actually need to return a pointer to a zero-initialized dummy value. Not > impossible, but getting a bit odd. Do we have a guarantee that callers of the peek only look at, never touch, the location? As long as we make it return a "const *", it might be OK, but a quick look at commit-slab.h tells me that we do not say "const".