I'm pretty sure this is what is happening.
Try this:
#!/usr/bin/rexx
share="ENVIRONMENT"
Say 'VALUE("FRED",8,share);==>' VALUE("FRED",8,share);
Say 'VALUE("FRED",,share);==>' VALUE("FRED",,share);
Say 'VALUE("FRED",.NIL,share);==>' VALUE("FRED",.NIL,share);
Say 'VALUE("FRED",,share);==>' VALUE("FRED",,share);
Say 'VALUE("DERF",4,share);==>' VALUE("DERF",4,share);
Say 'VALUE("FRED",,share);==>' VALUE("FRED",,share);
Say 'VALUE("DERF",,share);==>' VALUE("DERF",,share);
What happens is that after DERF is set to 4 FRED acts as if it has ben
unset.
In defining a new environmental, the system malloc'd the same memory
that was free'd, in the prior call.
I think that this can be fixed by putting an '=' sign into the first
character of the environmental variable, prior to free'ing the memory.
Bruce
On Sep 30, 2009, at 9:18 PM, Mark Miesfeld wrote:
> On Wed, Sep 30, 2009 at 9:07 PM, CVBruce <[email protected]> wrote:
>
>> Ok, I've been starring at this code, and I think that I understand it
>> now.
>>
>> The question I have is this.
>>
>> I can see where the memory that was alloc'd for the environmental
>> variable. I can see where the memory is free'd. But I don't see
>> where the pointer to the memory is set to a null-pointer value. So
>> the array of pointers, still has a pointer to the free'd memory.
>> Does
>> that make sense?
>
> Bruce, that's the way I read it also. I did post on the devel list,
> Rick usually has good insight to this.
>
> The thing is, if in the array of pointers, that pointer was set to
> null, then the next time the function was entered, the for loop would
> end prematurely:
>
> for(;*Environment != NULL;Environment++){
> np = *Environment;
>
> But, yeah, it looks to me like the array of pointers now has a pointer
> to free'd memory. It seems to work in Linux though. I usually work
> on Windows. I booted up a Linux system to look at this earlier, I'd
> have to boot up a system again to look more closely at the array.
>
> --
> Mark Miesfeld
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart
> your
> developing skills, take BlackBerry mobile applications to market and
> stay
> ahead of the curve. Join us from November 9-12, 2009. Register
> now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Oorexx-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel