Juergen Kuehlwein wrote:Static - dynamic:
to my understanding a static (fixed size) array´s descriptor must not be changed at runtime. That is number of dimensions and number of elements must be static. You must not be allowed to redim or erase such an array. This allows for compile time optimization. A dynamic array currently gets s assigned room for a maximum of 8 dimensions, which might be a waste of space, because most of times it will use less dimensions. On the other hand this is a requirement for an unrestricted redim and i think it should stay this way.
I had debated (with myself) over using "static" or "fixed". I originally selected "static", feeling it was opposite to "dynamic". After reading your understanding, I am thinking "fixed-length", and "variable-length", as fxm uses might be clearer. So I'm going to use FBARRAY_FLAGS_FIXED as the symbol name. Your understanding here seems OK.
The only reason the RTL prevents adding dimensions to a dynamic array at a redim, is that it cannot decide, if it´s a static or a dynamic array, which is to be redimmed. So in order not to corrupt memory or produce a GPF by accessing memory (added dimensions), which hasn´t been allocated for this purpose, it just forbids it.
This isn't quite correct. RTL allows unrestricted REDIM
first time only. After which, the number of dimensions is fixed from then on for the duration of program execution (but array bounds can still change on redim). Part of this restriction is likely due that the original number of entries available in the dimTb() table is lost. More on this later after fxm's comment.