C6322

Avertissement C6322 : bloc empty_except

Ce message indique qu'aucun code n'est contenu dans le bloc _except. En conséquence, il est possible que les exceptions ne soient pas gérées.

Exemple

Le code suivant génère cet avertissement :

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

Pour corriger cet avertissement, utilisez le code suivant :

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

Voir aussi

Référence

try-except Statement