zserio
zserio copied to clipboard
Cross language portability for variable size arrays
Consider the following variable array:
struct VariableArray
{
uint64 numElements;
uint8 uint8Array[numElements];
};
Currently, there is no runtime check for number of elements in variable arrays in C++, Java and Python generators. Thus, the maximum number of elements is bound to the underlying native language.
The solution could be to check all array length expressions during runtime not to exceed varsize
upper bound limit. If this is too restrictive for example for 64-bit C++ users only, we can introduce some special command line argument to disable such checking and to leave the decision to users.