This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug java/21540] switch stmt problem


------- Additional Comments From hchapman-gcc-bugs at 3gfp dot com  2005-05-19 15:09 -------
gcc has this problem as well. Although, it will let you have an expression using
only constants like

case 'A' + ('B'<<8):

but not

case *((uint16_t *)"AB"):

A gcc example:

#include <stdio.h>

int main()
{
  unsigned int xxx = 0x3456;

  switch(0x34)
  {
  case ((int)(xxx >> 16)):
    printf("Shift\n");
    break;
  default:
    printf("No shift\n");
    break;
  }

  return(0);
}

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21540


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]