To caps or not to caps that is the question?

Steve smorrey at gmail.com
Tue Dec 18 10:54:22 MST 2007


I get almost the same behavior if I explicitly initialize it in the for loop.
I saw the counter thing earlier this morning and tried.

However now the problem only occurs with an O2 build.  Why it doesn't
occur in O3 anymore is a big mystery to me.

Sincerely,
Steve

p.s. If anyone wants full sources so they can verify this behavior
please let me know and I'll get it to ya right away.

On Dec 18, 2007 9:36 AM, Levi Pearson <levi at cold.org> wrote:
> Steve <smorrey at gmail.com> writes:
> >
> > Here are the relevant lines.
> >      for(; counter < length; counter++)
> >      {
> >           coin = RandomNumber(0,100);
> >           letter = (letter == oldletter) ? ((coin <= 60) ?
> > PickChar(vowels) : PickChar(consonants)) : letter;
> >           letter = (counter == 0) ? toupper(letter) : letter;
> >           name += letter;
> >           oldletter = letter;
> >      }
> >      return(name);
>
> I agree with Nicholas, I think you're not initializing counter to 0.
> The optimization probably changes the stack layout a bit, which could
> leave a different bit of garbage in counter's stack slot depending on
> the optimization level.  It could also assign it to a register.  Who
> knows?  You could always look at the asm.
>
>                 --Levi
>
>
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */
>



More information about the PLUG mailing list