Subject: Re: timeout issue in scsi drivers: mstohz()
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 04/05/2002 12:14:59
> According to K&R 2 (and gcc) char and short are promoted to int
> before any arithmetic is done (interestingly I had thought that one
> of the differences between tranditional C and ansi C was that this
> was not the case....)

Well, the "as if" rule allows the compiler to not actually do the
promotion in many cases.

> However (a + 1ull) is long long if a is unsigned long.

That sounds like a bug to me.  I suspect the Standard may not have
anything to say about it because long long is a nonstandard type (ISTR
hearing that the upcoming new C standard will change this - or is it
actually a standard by now?).  However, I'm pretty sure that (a+1ul) is
unsigned long if a is unsigned int, even if long and int are different
sizes - maybe you're thinking of a+1l when a is unsigned int, which is
of type unsigned long or signed long depending on whether unsigned int
is narrower than unsigned long int?  (The "value preserving" versus
"signedness preserving" issue.)

Maybe we need :-)

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B