This is a fairly basic question, which for some reason, a proper solution escapes me at the moment. I am dealing with a 3rd-party SDK which declares the following structure:
struct VstEvents
{
VstInt32 numEvents; ///< number of Events in array
VstIntPtr reserved; ///< zero (Reserved for future use)
VstEvent* events[2]; ///< event pointer array, variable size
};
Even though this is a "variable sized" array, it's declared statically. So obviously, if I make a VstEvents object, set the numEvents to something, and then go through and start adding them to the array, it's going to cause memory corruption.
So how am I supposed to properly deal with a structure like this? Should I allocate my own VstEvent* array and then point events[0] to it?