I would like to know if Compile (or the language) treats different a variable like:
auto unsigned int a;
a = 8;
from:
auto unsigned int a;
a = 1 << 3;
To be more precise , here a = 8
in the location of a
it will be written the value 8
, so there is no importance which value was there (even if there is garbage).
What I am not sure is how does exactly works in this situation a = 1 << 3
.
I am sure that, inside a
there is a garbage value, and if for example a == 1341
( a garbage value ), then a = 1 << 3
results in 8
.
But if 1341
in binary representation means:
00000101 00111101
then I was expecting to be 10728
:
00101001 11101000
.
What I am not really sure here is, does a
being treated as 00000000
?
In this form a
gets initialized to 0
before the operation on the left is being executed?
Something like 00000000 = 1 << 3
?
Where a
becomes 0000 1000
, or how really works in this situation?
I do understand this unsigned int a = 0
, then a = a << 3
would be 8 = 0000 1000
, but this is different from my Question, because here a <<
the operations is on a
and not on 1
like in my Question.