[求助]HeapFree的异常用try catch捕捉不到
main()
{
char* p1=(char*)HeapAlloc( GetProcessHeap(),HEAP_ZERO_MEMORY,7);
strcpy(p1,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
try{
HeapFree(GetProcessHeap(),0,p1);
}
catch(...)
{
printf("error \n");
}
return 0;
}
显然strcpy以后p1会发生缓冲区溢出,try{}会发生异常,可是上述代码执行以后并没出打印出error字符串即catch{}没有执行,为什么会这样呢?