Re: [RFC][PATCH] t-prio-queue: simplify using compound literals
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 5, 2024, 22:01 UTC
- Message-ID
- <xmqqedbjtqnr.fsf@gitster.g>
- In-Reply-To
- <20240405191714.GA2561807@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Yeah, this seems pretty reasonable. I think we've traditionally been > hesitant to pass or return structs by value, but that's mostly > superstition.
We should still be hesitant against the practice to the same degree that we are hesitant against struct assignment, especially when the struct is of nontrivial size, or the struct has a pointer member whose memory ownership semantics goes against shallow copying of the struct.
In this particular case, I do not know offhand if .strftime_fmt is safe to be shallowly copied, but I trust you two know and/or have already looked at the implications.
Thanks.