CINT and switch

Glenn E. Cooper (gecooper@lbl.gov)
Thu, 03 Sep 1998 10:53:19 -0700


This is a multi-part message in MIME format.
--------------F3495243345E58BD652CEF0A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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
--------------F3495243345E58BD652CEF0A
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Glenn E. Cooper
Content-Disposition: attachment; filename="vcard.vcf"

begin: vcard
fn: Glenn E. Cooper
n: Cooper;Glenn E.
org: UC Berkeley/LBNL
adr;dom: 1 Cyclotron Rd.;;50A-1148;Berkeley;CA;94720;
email;internet: GECooper@lbl.gov
tel;work: 510-486-7129
tel;fax: 510-486-4818
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard

--------------F3495243345E58BD652CEF0A--