public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: "François Dumont" <frs.dumont@gmail.com>
Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [committed] libstdc++: Use unsigned char argument to std::isdigit
Date: Thu, 6 May 2021 13:43:32 +0100	[thread overview]
Message-ID: <20210506124332.GZ3008@redhat.com> (raw)
In-Reply-To: <20210505211434.GV3008@redhat.com>

On 05/05/21 22:14 +0100, Jonathan Wakely wrote:
>On 05/05/21 21:57 +0200, François Dumont via Libstdc++ wrote:
>>On 05/05/21 2:01 pm, Jonathan Wakely via Libstdc++ wrote:
>>>Passing plain char to isdigit is undefined if the value is negative.
>>>
>>>libstdc++-v3/ChangeLog:
>>>
>>>	* include/std/charconv (__from_chars_alnum): Pass unsigned
>>>	char to std::isdigit.
>>>
>>>Tested powerpc64le-linux. Committed to trunk.
>>>
>>       unsigned char __c = *__first;
>>-      if (std::isdigit(__c))
>>+      if (std::isdigit(static_cast<unsigned char>(__c)))
>>
>>I am very curious to know what this static_cast<unsigned char> does 
>>on __c which is already unsigned char ? If it does I'll just start 
>>to hate C++ :-)
>>
>>Maybe you wanted to put it on the previous *__first ?
>
>Ugh, yes, but it's not even needed there because the implicit
>conversion is fine.
>
>We do need to fix the isspace calls in src/c++11/debug.cc but this one
>was already correct. Thanks!

I've reverted that useless change, thanks for noticing it.



      reply	other threads:[~2021-05-06 12:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 12:01 Jonathan Wakely
2021-05-05 19:57 ` François Dumont
2021-05-05 21:14   ` Jonathan Wakely
2021-05-06 12:43     ` Jonathan Wakely [this message]

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=20210506124332.GZ3008@redhat.com \
    --to=jwakely@redhat.com \
    --cc=frs.dumont@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).