CINT and switch

From: Glenn E. Cooper (gecooper@lbl.gov)
Date: Thu Sep 03 1998 - 19:53:19 MEST


CINT apparently promotes case constants within
a switch statement to unsigned integers.  For
example,

void stest(Int_t a) 
{
  switch(a) {
  case 1:
    printf("%d=+1\n",a);
    break;
  case -1:
    printf("%d=-1\n",a);
    break;
  default:
    printf("Unknown %d\n",a);
    break;
  }
}

root [9] stest(1)
1=+1
root [10] stest(-1)
Unknown -1
root [11] stest(0)
0=-1

As far as I know, C/C++ allow case constants 
to be any integer, not just unsigned integers.
Or, at least, CINT ought not to covert

case -1:  --->   case 0:

but intead flag this as an error.

Glenn




This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:37 MET