| Why is 'a=GetIntArg (top_estack);' wrong?

Previous | TI-Basic and C | Next

Q: | What is wrong in doing
    a = GetIntArg (top_estack);
It seems that it works fine, but you always use an auxilary variable...
A: | It works fine sometimes, but not always. See, GetIntArg is a function-looking macro, with changes the value of its actual argument. So, if you write
    a = GetIntArg (top_estack);
you will also change the value of TIOS system variable top_estack, and I am not sure that you really want this. So, I strictly recommend using an auxilary variable, like in the following example:
    ESI argptr = top_estack;
    ...
    a = GetIntArg (argptr);
Using this method, you will avoid unexpected changes of top_estack.