删除运算符无法指定数组的边界
使用 /Za (ANSI) 选项,delete
运算符可以删除整个数组,但不能删除数组的部分或特定成员。
下面的示例生成 C2203:
// C2203.cpp
// compile with: /Za
int main() {
int *ar = new int[10];
delete [4] ar; // C2203
// try the following line instead
// delete [] ar;
}
删除运算符无法指定数组的边界
使用 /Za (ANSI) 选项,delete
运算符可以删除整个数组,但不能删除数组的部分或特定成员。
下面的示例生成 C2203:
// C2203.cpp
// compile with: /Za
int main() {
int *ar = new int[10];
delete [4] ar; // C2203
// try the following line instead
// delete [] ar;
}