Re: [PATCH] object-name: declare pointer type of extend_abbrev_len()'s 2nd parameter
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 8, 2025, 04:17 UTC
- Message-ID
- <xmqqh5xdzig2.fsf@gitster.g>
- In-Reply-To
- <81d10b44-5b3a-42af-acf4-ae76f2fee298@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 6 quoted lines
> I can see the appeal, even though (or because) it's kinda half a step > back as it keeps the original local variable, in a better place. > > We could _lunge_ forward and add type checks to allow the compiler to > tell us whether the pointers' journey through the void is safe. The > trick below is simple enough, but requires bespoke macros AFAICS.
Once there is even a single step of callback interface where the callback parameter has to be a generic "void *", we have to cast down to the concrete "struct min_abbrev_data *" either explicitly or implicitly anyway, so it does not really make that much of a difference (and that is why I said "we obviously do not have to").
Thanks.