Avertissement C6322

Bloc vide __except

Notes

Ce message indique qu’il n’y a pas de code dans le __except bloc. Par conséquent, les exceptions peuvent ne pas être gérées.

Nom de l’analyse du code : EXCEPT_BLOCK_EMPTY

Exemple

Le code suivant génère cet avertissement :

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

Pour corriger cet avertissement, utilisez le code suivant :

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

Voir aussi

try-except Instruction