[futurebasic] Re: [FB] XREF@ questions

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1998 : Group Archive : Group : All Groups

From: Jay Reeve <jktr@...>
Date: Wed, 25 Nov 98 01:40:27 -0600
>>>  XREF@ CLDES%(7,_CPMAX)
>
>>I believe it's usually safer to do this the other way around:
>>    XREF@ CLDES%(_CPMAX,7)
>>The compiler doesn't care what the first parameter is, only the later 
>>ones. The way you had it, the compiler set up your array to look at an 
>>indeterminate number of (_CPMAX+1)-element arrays. The other way, it 
>>looks at an indeterminate number of 8-element arrays. Even if it really 
>>doesn't matter, conceptually I'd rather deal with that. It also allows 
>>you to see all 8 values together in MacsBug, rather than scattered over 
>>vast distances.
>
>   THAT was the problem I was looking for.  I had the dimensions of the array
>in the wrong order.  I asked about that a few weeks ago, but was assured by
>somebody that I had done it properly...  I needed the array to be a long
>series of 8-byte blocks, not 8 very-large blocks.  I was indeed overflowing
>the handle I assigned for the array.
>
I'm delighted if this solved your problem, but now I'm confused, because 
the handle size for a _CPMAX x 7 array is exactly the same as for a 7 x 
_CPMAX array. Unless you were defining it in one order and addressing it 
in the other, I can't see how you would have written outside the handle.

>>>The array appears to work properly, but perhaps the compiler gets
>>>confused with it under some circumstances and reads/writes data to the wrong
>>>location? 
>>Sorry, but the compiler will do only what you tell it to. You may be able 
>>to confuse you or me, but not it.
>
>   IT IS possible to confuse the compiler.  I have done it many times.  As
>much as we hate to admit it, FB does have a few bugs and quirks. 

I'll acknowledge your point even though I, to my knowledge, have not 
encountered it. My comment was addressed more toward using XREF@, where I 
have never heard of a problem.

>>>If I use the debugger to show the contents
>>>of the 2nd array, it shows only bogus (and unchanging) values. 
>>The debugger, I believe, shows only addresses for XREF@ data, no values. 
>
>   The debugger WILL SHOW the contents of an XREF@ array.  It will display 
>the
>array contents (values) just like any other array.  They are just not the
>correct values.
>
Umm, you may be right. I was remembering my last use of XREF@, which used 
records rather than standard variable types, so all I got was addresses. 
I got curious so I just went to check--I'm not certain, but it looks as 
if maybe the debugger treats XREF@ as XREF--it doesn't derefereence the 
handle. (I did some quick code changes to see this, but managed to bomb 
before I could sort it all out.)

>   A thousand thanks Jay.  Your response pointed out my mistake.

You're welcome. Thanks for pointing out mine.

 0"0
 =J= a  y
  "