1.读取未赋值的局部变量。
2.函数栈溢出。
错误特征: "stack overflow"
一种原因是定义的变量体积太大 ,如 int a[1024*1024*6]
还有一种原因是函数递归调用,层次太深,没有终止条件,最终栈用光了。
3.数组越界访问
错误特征:"stack around the variable was corrupted"
4.指针的目标对象不可用
1) 空指针
错误特征: "未处理的异常:0xxxxxxxx:读取位置0x00000000时发生访问冲突"
2) 野指针
-指针未赋值
错误特征:“the variable is being used without being initialized”
-使用了已经free/delete释放了的对象
-不恰当的指针强制转换
比如: 将一个4字节的int 强制转换为8字节double
int main() { int a = 10; double *a = (double*)&a; // 可以转换,没有意义 *p = 123.456; // 但程序奔溃 }