Hi,

i'd like to ask the help of the list in clarifying a new warning in mainline. Let's assume x86-linux (so 32-bits, signed wchar_t, etc...) For this snipped I get a new warning:

int main()
{
 wchar_t wc = ((wchar_t)1 << 31) - 1;
return ((int)1 << 31) - 1; }

warning.cc:3: warning: overflow in implicit constant conversion

In particular, what's the difference between line 3 and line 4? I'm asking also because "another" compiler issues both:

warning.cc(3): warning #61: integer operation result is out of range
   wchar_t wc = ((wchar_t)1 << 31) - 1;
                                   ^

warning.cc(4): warning #61: integer operation result is out of range
   return ((wchar_t)1 << 31) - 1;

Thanks in advance,
Paolo.

Reply via email to