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

Re: [PATCH v3] utf8: make utf8_strwidth() and utf8_strnwidth() return size_t

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 27, 2026, 19:52 UTC
Message-ID
<xmqqtspkgqgp.fsf@gitster.g>
In-Reply-To
<DK9HO7JD6QT3.1ATJX1OLR8YBJ@gmail.com>
"Hardik Kumar" <hardikxk@gmail.com> writes:
Show 14 quoted lines
> On Mon Jul 27, 2026 at 8:25 PM IST, Junio C Hamano wrote:
>> Phillip Wood <phillip.wood123@gmail.com> writes:
>>
>>> I think it would be much better to remove the TODO comment as Junio 
>>> previously suggested and instead add some documentation to the function 
>>> explaining (a) why it is appropriate for it to return an int; (b) why we 
>>> must use the cast_size_t_to_int() helper to prevent overflows (see the 
>>> commit that added that comment).
>>
>> Thanks, especially for (b) above.  That needs to be stressed if we
>> are to go in that direction.
>
> Should this be documented in a new adoc file in the technical
> documentation directory?

The best thing for the new comment to do is to replace the misguided TODO comment that led us to this exercise.

Previous: Hardik KumarNext: Hardik Kumar
Message 17 of 23 in “change utf8_strwidth() return type to size_t”
  1. change utf8_strwidth() return type to size_tHardik Kumar, Jul 26, 2026
  2. René ScharfeJul 26, 2026
  3. Hardik KumarJul 26, 2026
  4. Pablo SabaterJul 26, 2026
  5. Hardik KumarJul 26, 2026
  6. utf8: use size_t for string width methods and callee sites.Hardik Kumar, Jul 26, 2026
  7. Junio C HamanoJul 27, 2026
  8. Junio C HamanoJul 27, 2026
  9. Hardik KumarJul 27, 2026
  10. Pablo SabaterJul 27, 2026
  11. Hardik KumarJul 27, 2026
  12. utf8: make utf8_strwidth() and utf8_strnwidth() return size_tHardik Kumar, Jul 27, 2026
  13. Hardik KumarJul 27, 2026
  14. Phillip WoodJul 27, 2026
  15. Junio C HamanoJul 27, 2026
  16. Hardik KumarJul 27, 2026
  17. Junio C HamanoJul 27, 2026
  18. Hardik KumarJul 27, 2026
  19. utf8: replace utf8_strwidth todo with descriptive commentHardik Kumar, Jul 27, 2026
  20. Phillip WoodJul 28, 2026
  21. Hardik KumarJul 28, 2026
  22. Junio C HamanoJul 28, 2026
  23. utf8: replace utf8_strwidth todo with descriptive commentHardik Kumar, Jul 28, 2026

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.