The manual mentions something to this effect.  What is tricky is
understanding when it works and when it breaks.
As a rule, if every variable used in a program is assigned once before
using VARPTR then you are for sure safe.

I guess using VARPTR with array variables complicates things.


On Tue, May 29, 2018 at 12:04 AM, Ken Pettit <petti...@gmail.com> wrote:

> One other interesting thing about BASIC variables.  A, A%, A%, A(1), A$(1)
> and A%(1) are all different variables and can exist at the same time with
> different values.
>
> Ken
>
>
> On 5/28/18 4:55 PM, John R. Hogerhuis wrote:
>
>
>
> On Mon, May 28, 2018 at 4:43 PM, Stephen Adolph <twospru...@gmail.com>
> wrote:
>
>> I think you must be right John,
>> because this line works
>>
>> 20 PRINT A$(S):F=256*PEEK( VARPTR(D$(S)) +2)+PEEK( VARPTR(D$(S)) +1)
>>
>>
> Yeah, the theory being that F as a left-hand-side of a (implied) LET
> allocates F before the (two) VARPTR operations. I suspect if you DIM your
> variables up front it would work either way. And you could DIM your numeric
> variables as INT (%)  and save a tiny bit of space / execution time.
>
> -- John.
>
>
>

Reply via email to