C6322

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

warning C6322: empty _except block

This message indicates that there is no code in the _except block. As a result, exceptions might go unhandled.

Example

The following code generates this warning:

#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)  
     {  
     }  
}  

To correct this warning, use the following code:

#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");     
     }  
}    

See Also

try-except Statement