check range of unsigned long

Discussion in 'C++' started by Wenjie Zhao, May 19, 2003.

  1. Wenjie Zhao

    Wenjie Zhao Guest

    Hello,

    Suppose I have a Validator class who is used to check
    inputs from other interface classes' input. Particular
    there is

    bool Validator::checkUnsignedLongRange(unsigned long start, unsigned
    long end, unsigned long value) {
    return (start <= value) && (value >= end);
    }

    I am concerned with unsigned comparisons here when (for convenience)
    use hex presentation:
    validatorObject.checkUnsignedLongRange(0x00000000, 0x00016FFF);

    Is the above 0x presentation OK in the context?


    Best regards,
    Wenjie
    Wenjie Zhao, May 19, 2003
    #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. George Marsaglia

    Assigning unsigned long to unsigned long long

    George Marsaglia, Jul 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    672
    Eric Sosman
    Jul 8, 2003
  2. Replies:
    1
    Views:
    450
    Diez B. Roggisch
    Jun 1, 2005
  3. Daniel Rudy

    unsigned long long int to long double

    Daniel Rudy, Sep 19, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,184
    Peter Shaggy Haywood
    Sep 20, 2005
  4. Junmin H.
    Replies:
    20
    Views:
    1,010
    Charlie Gordon
    Sep 20, 2007
  5. pozz
    Replies:
    12
    Views:
    732
    Tim Rentsch
    Mar 20, 2011
Loading...

Share This Page