|
From: Igmar P. <mai...@jd...> - 2005-10-18 09:49:43
|
> > As far as I can tell, the whole of uninit is undefined, so is the result
> > of the multiplication.
> >
> >> if(!(uninit & 1)) // there should be no error here
> >> {
> >
> > uninit still contains random data. Why shouldn't it give errors ?
>
> He is only looking at the lowest bit and as he has doubled it that
> bit is guaranteed to be zero and well defined.
The rest of the bits aren't defined. Since you can't address anything less
then a byte, it should give errors on these kind of operations if you ask
me.
> Multiplying by two is after equivalent to a left shift by one and
> such a shift is guaranteed to shift in a zero and hence make the
> bottom bit well defined.
You still take at least 8 bits when doing the and operation. From a
theoretical point it makes sense and you're right. From a logical sense
(partial) garbage in equals garbage out :)
Regards,
Igmar
|