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

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:
    5,928
    =?Utf-8?B?RGF2aWQgQW50b24=?=
    Feb 7, 2006
  2. bartek
    Replies:
    3
    Views:
    3,076
    bartek
    Feb 6, 2004
  3. John Black
    Replies:
    1
    Views:
    4,485
    John Harrison
    Apr 15, 2004
  4. yong

    Dealing with a large integer

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

Share This Page