Things that make me go "HMMMM!" :)
Spire_Jeff
Posts: 1,917
Ok, using this function:
Just a question I have, but I don't have time to play with it right now, so I decided to throw it out there for the masses to play with
Jeff
DEFINE_FUNCTION integer[MAX_NUM_DEVS] filterArray(integer type){ stack_var integer arrayX[MAX_NUM_DEVS]; stack_var integer x; switch (type){ case 1:{ // nUSER_BTN_TEST3 for(x=1;x<=LENGTH_ARRAY(nUSER_BTN_TEST3);x++) arrayX[x] = nUSER_BTN_TEST3[x]; return arrayX; } } }Does the stack_var that I am returning continue to exist after the function exits? If so, when does it finally clear itself from memory? Am I opening a path to memory leaks by doing this? This function is intended to be used to supply information to another function, so there are pointers flying all over the place... does NetLinx have an ATC (Air Traffic Controller) to deal with all of this elegantly?
Just a question I have, but I don't have time to play with it right now, so I decided to throw it out there for the masses to play with
Jeff
0
Comments
I agree with Vining here, BTW.
Like I said, I think it's more like Smear the Queer.
Jeff
P.S.
In case anyone is wondering about the situation, I have a function being called that creates a stack_var of type integer[]. There is a switch case that calls another function using the integer[] with different options based on the case. (a couple other things happen inside the case as well, but nothing tied to the integer[].) When the first case is used, the array passed is correct. When the second case is used, the array that was getting passed was not initialized. Right now there are only 2 different cases.
When ever I make an assignment like:
nSomeArray[x] = x
or
nSomeArray[x] = nSomeOtherArray[x]
I always call the function SET_LENGTH_ARRAY()
In your for loop try adding
for(x=1;x<=LENGTH_ARRAY(nUSER_BTN_TEST3);x++)
{
arrayX[x] = nUSER_BTN_TEST3[x];
SET_LENGTH_ARRAY(arrayX,x);
}
Dan
Jeff
I thought it would still work but I'm never quite sure of any thing lately. Sure enough the function holds and retains the value and changes to the initial value through out all the waits.
Jason... what you've described is called AFL....
GAHAHAHAHAHAHAHahahahhaa *cough* hah!