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. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.