Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #154855

Re: Puzzling "array subscript has type ‘char’" warning.

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: Puzzling "array subscript has type ‘char’" warning.
Date 2020-09-11 01:10 -0700
Organization None to speak of
Message-ID <87h7s4hgyb.fsf@nosuchdomain.example.com> (permalink)
References <e7Cdncm5EpqKbMfCnZ2dnUU7_83NnZ2d@giganews.com> <87lfhhge1m.fsf@nosuchdomain.example.com> <1eidnfKeDO6cjcbCnZ2dnUU7_8zNnZ2d@giganews.com>

Show all headers | View raw


Robbie Hatley <see.my.signature@for.my.contact.info> writes:
> On 9/10/2020 8:58 PM, Keith Thompson wrote:
[...]
>> Cast the argument to unsigned char:
>> 
>>     isdigit((unsigned char)*Ptr2
>> 
>> (Yes, it's annoying that you need to do thsis, and I consider it a
>> design flaw in the <ctype.h> functions, but there it is.)
>
> Fascinating. Yes, that's safer, because it forces the number to be
> in the [0,127] range. Thanks for the tip!

No, it forces it to be in the [0,255] range (assuming CHAR_BIT==8).

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Puzzling "array subscript has type ‘char’" warning. Robbie Hatley <see.my.signature@for.my.contact.info> - 2020-09-10 20:37 -0700
  Re: Puzzling "array subscript has type ‘char’" warning. Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-09-10 20:58 -0700
    Re: Puzzling "array subscript has type ‘char’" warning. Robbie Hatley <see.my.signature@for.my.contact.info> - 2020-09-10 22:49 -0700
      Re: Puzzling "array subscript has type ‘char’" warning. Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-09-11 01:10 -0700
        Re: Puzzling "array subscript has type ‘char’" warning. gazelle@shell.xmission.com (Kenny McCormack) - 2020-09-11 13:09 +0000
          Re: Puzzling "array subscript has type ‘char’" warning. Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-09-11 06:14 -0700
      Re: Puzzling "array subscript has type ‘char’" warning. Richard Damon <Richard@Damon-Family.org> - 2020-09-11 08:09 -0400
      Re: Puzzling "array subscript has type ‘char’" warning. James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-09-11 09:01 -0400
      Re: Puzzling "array subscript has type ‘char’" warning. Kaz Kylheku <793-849-0957@kylheku.com> - 2020-09-11 16:16 +0000
    Re: Puzzling "array subscript has type char" warning. dave_thompson_2@comcast.net - 2020-10-11 16:12 -0400
      Re: Puzzling "array subscript has type char" warning. Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-10-11 17:28 -0700
        Re: Puzzling "array subscript has type char" warning. dave_thompson_2@comcast.net - 2020-11-01 23:07 -0500
  Re: Puzzling "array subscript has type ‘char’" warning. jenniferjeson35@gmail.com - 2020-11-06 20:35 -0800

csiph-web