>I'm having a queer problem where a bunch of variables seem to be set to the same memory location.
>
>What happens is that setting the value of any of these variables results in all of them being set to the same value.
>
>All the vars are declared in a PRIVATE statement:
>
>Those vars and some declared PRIVATE earlier on are affected.
>
>Any ideas as to what can cause this? it looks like VFP's memory allocater has gone belly up, and is assigning the same memloc to all new variables created.
>
Are you sure you don't want to make them LOCAL rather than PRIVATE? PRIVATE variables 'inherit' downward in the call stack, so that:
PROCEDURE PrivateVersion
PRIVATE cString, nNumber
cString = 'Apple'
nNumber = 42
DO SecondLevel
? cString, nNumber && side effect makes it banana 42
PROCEDURE SecondLevel
PRIVATE nNumber && hides any higher-level instance of nNumber
cString = 'banana'
nNumber = 16
RETURN
LOCALs do not inherit downward, so:
PROCEDURE LocalVersion
LOCAL cString, nNumber
cString = 'Apple'
nNumber = 42
DO SecondLevel
? cString, nNumber && no side effect; Apple 42
>Help!
>
>-- jas