共用方式為


C6322

更新:2007 年 11 月

警告 C6322: 空白 _except 區塊

這則訊息表示 _except 區塊中沒有程式碼。因此,可能無法處理例外狀況。

範例

下列程式碼將產生出這個警告:

#include <stdio.h>
#include <excpt.h>
#include <windows.h>

void fd(char *pch)
{
   __try
     {
       // exception rasied 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 rasied if pch is null
      *pch= 0 ;
     }
   __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? 
               EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
     {
       // code to handle exception
       puts("Exception Occurred");   
     }
}  

請參閱

參考

try-except Statement