Share via


C6322

경고 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