Increase the number of elements allowed for UDT
richardFK opened this issue · 4 comments
QB64x64 dev 18b5b30 Windows 10 Pro 21H1 build (updated Aug)
I noticed that the maximum number of elements allowed for UDT, either as a single UDT or collectively as a group of 16 UDT's, is 992 elements - irrespective of what AS ... is.
If have
$NOPREFIX
DIM U AS UDT: temp% = LEN(U)
TYPE UDT
b000 AS UNSIGNED BYTE
b001 AS UNSIGNED BYTE
b002 AS UNSIGNED BYTE..
...
b990 AS UNSIGNED BYTE
b991 AS UNSIGNED BYTE
b992 AS UNSIGNED BYTE
END TYPE
If the line b992... is not ticked out, get the IDE status message
Compiler error (check for syntax errors) (Subscript out of range:9-1947) on line ...
This 992 limit is the same maximum number if I spread evenly over 16 UDTs (each of 64 elements).
Probably 99+% of users would never need this many UDT elements, and I may find a workaround myself, but mainly just curious on the limit (what is the significance of the number 992 apart from being a multiple of 32 (decimal)?
udtenext
needs to be dynamically resized, instead of being statically limited to 1000 entries.
I am not sure how to dynamically resize - is it just changing the word DIM to REDIM (only) in my example supplied?
Sorry, that was a dev note - it's an internal array that the compiler needs to manage better.
Hopefully very soon a developer can make this simple sounding change for me (I am in the middle of a big program) - of course simple sounding requests often are not simple to do.