Difference between revisions of "AGOS/TODO"

Jump to navigation Jump to search
147 bytes added ,  18:16, 9 April 2006
Updated my thoughts about the missing line breaks.
(Added lengthy, rambling note about the line break bug in Oracle.)
(Updated my thoughts about the missing line breaks.)
Line 43: Line 43:
So how did this happen? Shouldn't the line have been broken at the previous word? No, in fact it should not. At that point, <tt>_printCharCurPos</tt> is 327 and <tt>count</tt> is 31. The word fits, just barely, and <tt>_printCharCurPos</tt> is increased to 358. Problem is, the line break check is triggered, here as almost always, by a space. And in that case the width of that space will ''also'' be added to <tt>_printCharCurPos</tt>, bringing it up to 366.
So how did this happen? Shouldn't the line have been broken at the previous word? No, in fact it should not. At that point, <tt>_printCharCurPos</tt> is 327 and <tt>count</tt> is 31. The word fits, just barely, and <tt>_printCharCurPos</tt> is increased to 358. Problem is, the line break check is triggered, here as almost always, by a space. And in that case the width of that space will ''also'' be added to <tt>_printCharCurPos</tt>, bringing it up to 366.


So to fix it, we either need to test for "overflow" when adding the width of the space, or - which seems like a better solution to me - we could change the variables to be signed. The strange thing is: the original appears to take neither of these precautions. Is it possible that the compiler ''Adventure Soft'' used behaved differently in this case, or are we missing some subtle detail...?
There are several possible fixes. A few that comes to mind:
 
* Change the variables from unsigned to signed.
* Check for overflow when adding the width of the space. (I don't like this one myself.)
* Rewrite the test so that signedness doesn't matter, e.g. <tt>if (_printCharPos + count <= _printCharMaxPos)</tt>
 
Oddly enough, the original ''does'' use unsigned variables, and take none of these precautions. Is it possible that the compiler ''Adventure Soft'' used behaved differently (buggily?), or are we missing some subtle detail...?
415

edits

Navigation menu