Currently, arrays can only be declared in a global scope. Sometimes it might be handy to have a possibility to use a locally declared array, even though in reality the array would still be global. key features:
- Local arrays aren't accessible outside the function scope (obviously).
- Local arrays in two functions that are never invoked concurrently can share the underlying variables. This actually is where local arrays make the most sense, as the compiler can do the work of identifying and realizing the ways to share the arrays instead of the programmer.
- Because of the above point, local arrays do not guarantee the content to be preserved between function calls. Perhaps some options or modifiers could be provided to prevent memory sharing, but there's always a workaround: make the array global.
- Local arrays allow the data flow to be more easily analyzed, but I'm not sure I'd be able to utilize that right at this moment.
- For recursive functions, local array sizes will be multiplied by the stack depth (using the
stack-depth option valid for the function). The starting array index will be incremented in each function call, and decremented on exit. Even accesses at a constant index won't be resolved into individual array element due to the variable start offset.
Currently, arrays can only be declared in a global scope. Sometimes it might be handy to have a possibility to use a locally declared array, even though in reality the array would still be global. key features:
stack-depthoption valid for the function). The starting array index will be incremented in each function call, and decremented on exit. Even accesses at a constant index won't be resolved into individual array element due to the variable start offset.