Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Hardik Kumar" <hardikxk@gmail.com>
Cc: "Phillip Wood" <phillip.wood123@gmail.com>,
	git@vger.kernel.org, "Patrick Steinhardt" <ps@pks.im>,
	"René Scharfe" <l.s.r@web.de>,
	"Pablo Sabater" <pabloosabaterr@gmail.com>
Subject: Re: [PATCH v3] utf8: make utf8_strwidth() and utf8_strnwidth() return size_t
Date: Mon, 27 Jul 2026 12:52:38 -0700	[thread overview]
Message-ID: <xmqqtspkgqgp.fsf@gitster.g> (raw)
In-Reply-To: <DK9HO7JD6QT3.1ATJX1OLR8YBJ@gmail.com> (Hardik Kumar's message of "Mon, 27 Jul 2026 21:50:14 +0530")

"Hardik Kumar" <hardikxk@gmail.com> writes:

> 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.


  reply	other threads:[~2026-07-27 19:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-26 12:34 [PATCH] change utf8_strwidth() return type to size_t Hardik Kumar
2026-07-26 13:41 ` René Scharfe
2026-07-26 15:50   ` Hardik Kumar
2026-07-26 14:52 ` Pablo Sabater
2026-07-26 15:52   ` Hardik Kumar
2026-07-26 19:57   ` [PATCH v2] utf8: use size_t for string width methods and callee sites Hardik Kumar
2026-07-27  0:06     ` Junio C Hamano
2026-07-27  4:02       ` Junio C Hamano
2026-07-27  6:42         ` Hardik Kumar
2026-07-27  1:06     ` Pablo Sabater
2026-07-27  6:40       ` Hardik Kumar
2026-07-27  6:59 ` [PATCH v3] utf8: make utf8_strwidth() and utf8_strnwidth() return size_t Hardik Kumar
2026-07-27  7:04   ` Hardik Kumar
2026-07-27 12:51   ` Phillip Wood
2026-07-27 14:55     ` Junio C Hamano
2026-07-27 16:20       ` Hardik Kumar
2026-07-27 19:52         ` Junio C Hamano [this message]
2026-07-27 16:13     ` Hardik Kumar
2026-07-27 21:15 ` [PATCH v4] utf8: replace utf8_strwidth todo with descriptive comment Hardik Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqtspkgqgp.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=hardikxk@gmail.com \
    --cc=l.s.r@web.de \
    --cc=pabloosabaterr@gmail.com \
    --cc=phillip.wood123@gmail.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox