08:40 am, 28 Jan 05
find the bug!
A friend got me with this one:
(If you wanna hide your answers I think you can wrap them in <div style='color: white; background: white'></div>.)
... One of my co-workers has spent the past 4 days debugging garbled output from the UI library I own ... The problem ended up being in his code:Where’s the bug?
string displayable = longerString.substr( 0, COLS );
(If you wanna hide your answers I think you can wrap them in <div style='color: white; background: white'></div>.)
That hidden text thing is an ugly hack! It's a good thing I'm not using Opera 6 anymore, because it would simply invert the selected area rather than drawing it white-on-blue, meaning the big white space would just become a big black space.
I won't bother taking part here because I saw this being discussed in your other entry t'other day. ;) LiveJournal S2 has (or had at one point; perhaps a Perl upgrade has fixed it by now) a big similar to this making the substr function pretty useless. I won't go into any more detail lest I spoil the game.
Indeed. I upgraded to Opera 7 about a month ago.
I didn't acutally confirm this, so it's likely to be wrong.
Just so i know, is there any way I should have known that?
But also, the problem was garbled output, while getting the casing wrong would more likely produce a compilation error.
I was thinking that there was also a "string" class in scope, so the compiler wouldn't complain. But naming a class "string" would make your friend the worst developer ever, so I'm glad that wasn't the case.
Random guess:
That doesn't seem very likely though.
string str18 = "abcdefghi"
string str19 = str18.substr (6,2);
cout << str19 << endl; // "gh"
looks pretty much the same, expect for 'COLS'. And I can't think of a way that that would cause garbled output (garbled how btw?).
You win!!!!11111111111