[futurebasic] Re: [FB] 'as pointer to' bug?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2002 : Group Archive : Group : All Groups

From: "Steven J. Stratford" <sstrat@...>
Date: Sun, 29 Sep 2002 08:33:19 -0500
On 9/29/02 7:59 AM, "Alain Pastor" <pixmix@...> wrote:

> 
> 
> Steven J. Stratford wrote:
>> This works in OS 9, but application quits unexpectedly in OS X before
>> printing anything. Using R7. Any ideas? If I "dim test as b" it works fine
>> but I need the pointer.
>> 
>> begin record a
>> dim something as long
>> end record
>> 
>> begin record b
>> dim whatever as a
>> end record
>> 
>> dim test as ^b
>> 
>> window 1
>> test.whatever.something = 1
>> 
>> print test.whatever.something
>> 
>> do
>> handleevents
>> until 0
>> 
> 
> I think the problem in your code is that the following statement:
> 
> dim test as ^b
> 
> declares the variable test as a pointer to some kind of variable, but
> that it doesn't allocate the storage for the variable pointed to by
> the pointer.
> 
> The value you are setting for the field of the undeclared variable is
> placed somewhere in memory and this may crash the program immediately
> or not depending on the severity of the mess produced. Perhaps the
> immediate crash in OS X is due to the protected memory scheme.

Ah! You are so right. I was rewriting some code and forgot the newptr code.
Thanks.

--Steve

Steven J. Stratford, InterNetyx.com
http://www.internetyx.com
Web Site hosting services
CGI shareware for Mac/WebStar servers
Custom CGI programming