空白
__except區塊
備註
此訊息表示 區塊中 __except 沒有程序代碼。 因此,例外狀況可能會未處理。
程式碼分析名稱:EXCEPT_BLOCK_EMPTY
範例
下列程式代碼會產生此警告:
#include <stdio.h>
#include <excpt.h>
#include <windows.h>
void fd(char *pch)
{
__try
{
// exception raised if pch is null
*pch= 0 ;
}
__except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
{
}
}
若要更正此警告,請使用下列程序代碼:
#include <stdio.h>
#include <excpt.h>
#include <windows.h>
void f(char *pch)
{
__try
{
// exception raised if pch is null
*pch= 0 ;
}
__except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ?
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
// code to handle exception
puts("Exception Occurred");
}
}