On Dec 18, 2009, at 7:27 PM, Vincent Torri <vincent.torri at gmail.com> wrote:
> hey, > > i have an enum in which a value is set as 1L << 31. suncc reports: > > warning: integer overflow detected: op "<<" > > I don't understand as, afaik, an enum is considered as an int and 1 > << 31 fits in an int. Can someone explain we what is wrong ? It doesn't fit. A 32-bit int has a range of -2^31 to 2^31-1. That result can't be represented. 1U<<31 fits in an unsigned int, but 1<<31 doesn't in a signed one.
