Dealing with ctype.h integer overflow

Discussion in 'C Programming' started by elitemx, Jun 28, 2010.

  1. elitemx

    elitemx

    Joined:
    Jun 28, 2010
    Messages:
    1
    Likes Received:
    0
    What is the proper way to deal with character values which when casted to an unsigned char fall between {INT_MAX + 1 ... UCHAR_MAX} where UCHAR_MAX is greater than INT_MAX.

    Code (Text):
    int is_digit2(char c) {
        unsigned char uchar = c;
        if(uchar > INT_MAX)
            return MAYBE;
        return isdigit(uchar) ? YES : NO;
    }
     
    elitemx, Jun 28, 2010
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Sm9l?=

    CType(x,Integer) vs. Integer.Parse(x)

    =?Utf-8?B?Sm9l?=, Feb 6, 2006, in forum: ASP .Net
    Replies:
    7
    Views:
    6,217
    =?Utf-8?B?RGF2aWQgQW50b24=?=
    Feb 7, 2006
  2. bartek
    Replies:
    3
    Views:
    3,291
    bartek
    Feb 6, 2004
  3. John Black
    Replies:
    1
    Views:
    4,699
    John Harrison
    Apr 15, 2004
  4. deancoo

    integer or long overflow...

    deancoo, Mar 5, 2005, in forum: C++
    Replies:
    11
    Views:
    1,005
    Pete Becker
    Mar 5, 2005
  5. Enrico 'Trippo' Porreca

    Integer overflow

    Enrico 'Trippo' Porreca, Aug 21, 2003, in forum: C Programming
    Replies:
    9
    Views:
    654
  6. Ashutosh Iddya

    integer overflow

    Ashutosh Iddya, Apr 16, 2004, in forum: C Programming
    Replies:
    25
    Views:
    1,147
    RoSsIaCrIiLoIA
    Apr 24, 2004
  7. yong

    Dealing with a large integer

    yong, Mar 3, 2006, in forum: C Programming
    Replies:
    42
    Views:
    1,469
  8. Slain
    Replies:
    2
    Views:
    361
    Alf P. Steinbach
    Jul 12, 2007
Loading...