[Color Computer] [Coco] Bug in FOR NEXT ?
Frank Pittel
fwp at deepthought.com
Thu Jun 1 18:59:41 EDT 2006
I always that the loop counter was "undefined" outside the loop. By undefined
I mean that the value is implementation dependant and not guaranteed to be any
specific value.
On Thu, Jun 01, 2006 at 05:31:18PM -0400, Arthur Flexser wrote:
> There is actually a genuine bug in the way CoCo Basic processes FOR/NEXT. It
> was in fact the subject of an article in Byte in the early 80s because the same
> bug occurs in various other Microsoft Basics as well. My memory is a bit hazy
> on the details, but here's what I recall; perhaps someone here can concoct a
> Basic program that illustrates the bug. I believe that the bug produces a
> spurious ?NF (NEXT without FOR) error. I did once encounter it in a program I
> wrote, soon after I bought my CoCo and before seeing the Byte article; I called
> Tandy about it (back in those days they actually had phone support), but the
> techie I spoke with was stumped, not surprisingly.
>
> The bug occurs when you exit an initial FOR/NEXT loop without completing it
> (which is perfectly legal to do) and then reuse the same loop variable name in a
> later loop. It is critical that the NEXT statements contain the variable name
> (i.e., NEXT Z, not just NEXT) for the bug to occur. I think maybe the variable
> that was previously used in an inner loop must be used later in an outer loop,
> or possibly vice versa. As I said, my memory is pretty vague on this, even
> though I did at one time trace the source of the bug in the ROM code.
>
> Anyone want to fiddle around with coming up with some code that produces the
> spurious ?NF error?
>
> Art
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
More information about the Coco
mailing list