We've a call stack in our project. The program is written for microcontroller, the language is C. The call stack is basically an array of integers. The variable that represents this call stack ends with the string
I was reviewing the implementation. The feature is reset recovery, not the call stack, but the call stack is part of the feature. When I first saw the variable, I thought it is used as a stack. So I assumed the following:
- No entries other than the last entry can be accessed.
- There will be PUSH/POP/CLEAR/TOP operations.
Next, I found that the first entry (index 0) is always checked in a special condition. I also found a function where all elements of the array are read sequentially from index 0 to top. Both of them are invalid stack operation.
I am thinking that the variable name should not contain the string
stack as it is not a stack, rather it is used as a list. But the coder is showing valid logic, that according to semantic meaning, it's a stack and there is in fact PUSH operations.
Should the variable be named with