我想我应该得到allData的以下 char 数组定义的编译错误:
void MyClass::aMethod(const char* data, int size)
{
int headerSize = 50;
MyHeader header;
//size is not constant and unknown at compile time
char allData[size + headerSize]; //<<<<<==== should not allowed!! but not error??
memcpy(allData, &header, headerSize);
memcpy(allData + headerSize, data, size);
....
}
为什么?它会给出运行时错误吗?