[futurebasic] Re: [FB] [FB2] XREF Array of Records (lengthy)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1999 : Group Archive : Group : All Groups

From: Sean -G3- <mclaugh@...>
Date: Fri, 22 Oct 99 16:13:54 -0500
>There certainly is a (very serious) bug in XREF arrays of records, and it's
>been around for years.  But I've never heard it explained in the terms Sean
>uses, so I'm not sure if the bug I'm thinking of is the same thing that Sean
>is describing.  In my "version" of the bug, you
>can crash if you attempt to reference any field in the record except the 
>first
>field, in any element of the array.  This bug does NOT exist for XREF@, but
>only for XREF.
>
>Here's a demo.  Note that the address of XREFarray.field2%(1) is obviously
>bad.  If you un-comment the two commented-out instructions in FN XREFtest, 
>the
>program is likely to crash.  In some cases you'll get lucky, and the bad
>address you're accessing will by chance not step on anything important 
>(yet). 
>In this case your program may not crash, but some other program may crash
>later when it needs to access that (now corrupted) memory.

I got the information from an example, I am not very familiar with any of 
this myself:

FB2: (FB) Examples: Reference: X: XREF@ #1.BAS

It talks about a workaround:
'Here we use a bit of a workaround: when FB finds an XREF@ for a RECORD 
array,
'it sets aside one RECORD, rather than a long integer, to hold the base 
of the
'array (the handle).  This will probably be fixed in an update, but for 
now the

As I said, I'm not an expert of this realm, mabye this bug was already 
fixed. Or mabye this isn't even related to the bug in my program.

Sean