"Serve Laurijssen" <> writes:
> "Eric Sosman" <> schreef in bericht
> news:McOdnWqfr-...
>> Serve Laurijssen wrote:
>>> I've been working on an old 8-bit system and came across a problem
>>> with the << operator
>>>
>>> This would always yield 0:
>>>
>>> unsigned char i;
>>> for (i = 0; i < 4; i++)
>>> {
>>> unsigned char idx = 1 << i;
>>> ....
>>> }
>>
>> By "yield 0" do you mean that the value of idx was
>> always zero in "...."? That shouldn't be so: idx should
>> have been 1, 2, 4, 8 on the four loop iterations. How
>> did you discover that idx was zero (or have I not
>> understood your complaint)?
>
> That was what I meant yes. It was seen with a debugger. I'm guessing a
> compiler bug then
Or a debugger bug.
[...]
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"