Just another odd issue?
vining
Posts: 4,368
I changed a value of a constant from 64 to 128 and then when I compiled I got this error:
referring to this variable:
These are the constants:
ERROR: E:\******************************VAV_ControlByWeb.axi(181): C10219: Array [CCBW_EMAIL_STR] must have an initializer if bounds are not specified
referring to this variable:
VOLATILE CHAR cCBW_Email_Str[CBW_NUM_EMAILs * CBW_LEN_EMAILs];
These are the constants:
INTEGER CBW_NUM_EMAILs = 6; INTEGER CBW_LEN_EMAILs = 128;Now if I change the 128 to any other number, 127, 129, 64, 300 I don't get the error but as soon as I change it back to 128 the error comes back. Not a big deal, just another one of those things that make you go WTF!
0
Comments
However, these work fine:
That's messed up.
But, to the point, I then thought it had to do with some kind of fussiness with the fact that 127 and 128 are obvious points of interest if the under-the-hood dimensional size parameter might be a signed integer. (128 being equal to -127) I then tried several permutations around the signed integer turn around points at different nodes but they seem to work fine. Reversing the order behaved the same way. Oddly enough setting both values to 128 fails but having one be 127 and 128 works fine.
So, it's clearly some issue with a signed integer as it does have nodes where it works and doesn't.
I guess it's something I probably wouldn't do anyway since in a lot of development environments you can't get away with such frippery. But it is fascinating to watch.
function:
Yes. I've never had ant issue with them. But, there is the weird thing that happens in Netlinx that is maddening.
If you pass a global variable into a function, and then do something to change the declared variable value in the function, that change gets propagated backwards into your global. I've gotten into the habit of putting the value(s) I need to go into the funtciton into stack_vars, passing them into the function, and then even in the function, taking the passed in values and storing them in stack_vars there to process. It drives me crazy.
That it updates the global isn't the "weird" part, that works similarly to pass by reference in other common/standard languages. What is "weird" (I prefer interesting) is that AMX Functions are more "pass/return by <working> copy", than a true pass by reference implementation... I can understand why the compiler writers did it (simpler), but it isn't really standard with regards to async behaviour.