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

Re: [PATCH 2/5] roaring.[ch]: apply Git specific changes to the roaring API

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 19, 2022, 22:02 UTC
Message-ID
<xmqqr10781lx.fsf@gitster.g>
In-Reply-To
<b727c25c-469f-ca56-bbd6-82f82c762523@github.com>
Derrick Stolee <derrickstolee@github.com> writes:
Show 8 quoted lines
>>  int32_t array_container_write(const array_container_t *container, char *buf);
>> +
>> +int array_container_network_write(const array_container_t *container,
>> +				  int (*write_fn) (void *, const void *, size_t),
>> +				  void *data);
>
> Should we make write_fn a defined type? I'm not sure I've seen this
> implicit type within a function declaration before.

Unless we can point out why having a named type is a good idea (e.g. we add such a function pointer as a member of a struct, or we keep a variable of that type somewhere), I actually would prefer to do without them.

Perhaps there are some more important reasons I am missing why we often come up with explicit types for callback function pointers in many parts of our API, but if there aren't, my preference actually is to lose them, not add more of them.

Hmph.... could "a typedef can become a place to give definitive documentation for the class of callback functions" be a good reason why we would want one? I dunno.

In the posted patch, readers cannot tell what kind of three parameters they are supposed to give to write_fn().

Thanks.
Previous: Derrick StoleeNext: Derrick Stolee
Message 6 of 25 in “[RFC] introduce Roaring bitmaps to Git”
  1. 0/5 [RFC] introduce Roaring bitmaps to GitAbhradeep Chakraborty via GitGitGadget, Sep 19, 2022
  2. 1/5 reachability-bitmaps: add CRoaring library to GitAbhradeep Chakraborty via GitGitGadget, Sep 19, 2022
  3. 4/5 roaring: introduce a new config option for roaring bitmapsAbhradeep Chakraborty via GitGitGadget, Sep 19, 2022
  4. 2/5 roaring.[ch]: apply Git specific changes to the roaring APIAbhradeep Chakraborty via GitGitGadget, Sep 19, 2022
  5. Derrick StoleeSep 19, 2022
  6. Junio C HamanoSep 19, 2022
  7. Derrick StoleeSep 20, 2022
  8. Abhradeep ChakrabortySep 20, 2022
  9. Junio C HamanoSep 21, 2022
  10. Abhradeep ChakrabortySep 20, 2022
  11. 3/5 roaring: teach Git to write roaring bitmapsAbhradeep Chakraborty via GitGitGadget, Sep 19, 2022
  12. Junio C HamanoSep 30, 2022
  13. Abhradeep ChakrabortySep 30, 2022
  14. Abhradeep ChakrabortyOct 30, 2022
  15. Derrick StoleeOct 30, 2022
  16. Abhradeep ChakrabortyOct 31, 2022
  17. Junio C HamanoOct 31, 2022
  18. C99 -> C11 or C17? (was: [PATCH 3/5] roaring: teach Git to write roaring bitmaps)Ævar Arnfjörð Bjarmason, Oct 31, 2022
  19. rsbecker@nexbridge.comOct 31, 2022
  20. Abhradeep ChakrabortyNov 1, 2022
  21. 5/5 roaring: teach Git to read roaring bitmapsAbhradeep Chakraborty via GitGitGadget, Sep 19, 2022
  22. Derrick StoleeSep 19, 2022
  23. Abhradeep ChakrabortySep 20, 2022
  24. Taylor BlauSep 20, 2022
  25. Abhradeep ChakrabortySep 21, 2022

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.