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.