On Thu, Jan 12, 2023 at 05:22:04PM +0100, Ævar Arnfjörð Bjarmason wrote: > We have members like "struct strbuf"'s "buf", which always needs to be > init'd, but never "maybe by the user", so the pattern above would work > there. We've discussed in the past having a strbuf that points to an existing buffer, over which it takes ownership. Or a const string that we'd leave behind (but not free) if we needed to grow. In those cases you'd want to pass in a buffer to the allocator. Of course in the case of a strbuf those initializers would probably just be totally separate from the regular slopbuf one, just because there's not much else in a strbuf to initialize. You don't gain much from trying to avoid repetition. > Anyway, I agree that it's not worth pursuing this in this case. > > But I think it's a neat pattern that we might find use for sooner than > later for something else. I remain unconvinced. ;) Mostly just that the lines saved versus the amount of magic and thought doesn't seem reasonable. But it's something we can keep in mind as new opportunities show up. -Peff