This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

enum, out of range

Hello,

I have added U postfix to the integer but the problem still is the same.

I read following pages but didn't work.
http://www.keil.com/support/docs/3243.htm
http://www.keil.com/forum/14703/

#define M(x)         (u32)(1U << (x%32))

enum{
   eFirst = M(x)
   .....
   eLast = M(31)     // generate "integer operation result is out of range"
}

Can I avoid this warning?

Parents
  • The implementation is free to choose the underlying type of an enum, but it must cover all values given.

    Probably keil choose int and are letting you know your values are too big for what it wants.

    You could consider defeat and use a series of defines.

Reply
  • The implementation is free to choose the underlying type of an enum, but it must cover all values given.

    Probably keil choose int and are letting you know your values are too big for what it wants.

    You could consider defeat and use a series of defines.

Children