Really strange bug in Output

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Really strange bug in Output

shirajg
I'm really not seeing why sometimes I'm getting missing letters when running the test the Output class. I'm looking through what I wrote and have no idea where this bug may be coming from. Not sure if anyone can help or has seen this before, but I'll attach a screenshot. The strangest part is that letters disappear from within the printString call, which does the same thing for each letter...
Reply | Threaded
Open this post in threaded view
|

Re: Really strange bug in Output

cadet1620
Administrator
Very strange indeed.

Are you testing in the OutputTest directory with only the supplied Main.jack and your Output.jack?

This has the look of an uninitialized variable problem or an 'if' or 'while' statement that is testing an integer value instead of a boolean. (That's a common problem for me since most languages treat value != 0 as true, but JackCompiler uses value == -1.)

If you want me to take a look at your code, feel free to email it to me. (I'll be on the road Friday and Saturday so my net access will be spotty on those days.)

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Really strange bug in Output

shirajg
Yes, I am testing with just the supplied Main, and my own Output.jack.

I'll look into the case of maybe an integer comparison instead of boolean. I do use a binary & to determine odd/even in the code, so maybe something there goes wrong.

Thanks for the help! I'll update with the resolution.
Reply | Threaded
Open this post in threaded view
|

Re: Really strange bug in Output

cadet1620
Administrator
Also watch out for missing () in bit testing since the compiler evaluates expressions from left to right. I was making that mistake often enough I added a warning to my compiler whenever an expression wasn't unambiguously parenthesized.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Really strange bug in Output

shirajg
Thanks for the help, I figured it out. Turned out to be a different issue totally. I was making permanent modifications to the glyphs in the table due to how I was accessing the array. This in turn was causing glyphs to print correctly the first time, but be modified on subsequent prints. Trying not to say too much to not give away the solution...