uint32_t weirdness

el_supremo:
Definitely.
That's not a comforting thought. A bug is a bug. Fix it, and then if there are still problems you will know that at least the initial value of 'a' is not causing any of them.

Based on my quick test, not initializing 'a' is the problem.

Pete

Pete, you are correct, Initializing 'a' does 'solve' the problem, but how did initializing 'a' change the code generated generated in the while() loop?

htoli("800")=
 c(chr)=8 b=0  after mul b=0 c(dec)=8, after add (b=b+c) b=8
 c(chr)=0 b=8  after mul b=128 c(dec)=0, after add (b=b+c) b=128
 c(chr)=0 b=128  after mul b=2048 c(dec)=0, after add (b=b+c) b=2048
result =2048

Chuck.

p.s. still lost in the Dark!