Hello!
Rob Leslie schrieb am Mon, 06 Nov 2000: :: > Shouldn't is_pos at least be initialised to 0? From the looks of :: > things, there's code paths to the first check of is_pos at line 1136 :: > where is_pos isn't explicitly set, and an automatic variable's default :: > value is undefined (whatever was left on the stack or in the register at :: > the time). :: :: The way the code is structured, is_pos is always set the first time through :: the loop before it is checked at line 1136. GCC doesn't see this, but you can :: follow the logic. :: :: The problem with initializing the value inside the for block is that it is :: reset *each time* through the loop, whereas it should retain its previous :: value until certain conditions are met (namely, a window or scalefactor band :: boundary is crossed.) :: :: Another way to fix this is to move the declaration with initial value up into :: the containing block. :: :: Cheers, :: -rob
Sounds like it would be better a static variable? for (i = bound; i < 576; ++i) { static unsigned int is_pos = 7;
This way it gets it initial value once and keeps then the value from the previous iteration.
Ciao Robert