git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.
Previous: René Scharfe
Message 4 of 4 in “object-name: declare pointer type of extend_abbrev_len()'s 2nd parameter”
  1. object-name: declare pointer type of extend_abbrev_len()'s 2nd parameterRené Scharfe, Sep 4, 2025
  2. Junio C HamanoSep 4, 2025
  3. René ScharfeSep 7, 2025
  4. Junio C HamanoSep 8, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.