__ud2

Sezione specifica Microsoft

Genera un'istruzione non definita.

Sintassi

void __ud2();

Osservazioni:

Il processore genera un'eccezione opcode non valida se si esegue un'istruzione non definita.

La funzione __ud2 è equivalente alle UD2 istruzioni in linguaggio macchina. Per altre informazioni, cercare il documento "Intel Architecture Software Developer's Manual, Volume 2: Instruction Set Reference", nel sito Intel Corporation .

Requisiti

Intrinsic Architettura
__ud2 x86, x64

<File di intestazione intrin.h>

Fine sezione specifica Microsoft

Esempio

Nell'esempio seguente viene eseguita un'istruzione non definita, che genera un'eccezione. Il gestore eccezioni modifica quindi il codice restituito da zero a uno.

// __ud2_intrinsic.cpp
#include <stdio.h>
#include <intrin.h>
#include <excpt.h>
// compile with /EHa

int main() {

// Initialize the return code to 0.
int ret = 0;

// Attempt to execute an undefined instruction.
  printf("Before __ud2(). Return code = %d.\n", ret);
  __try {
  __ud2();
  }

// Catch any exceptions and set the return code to 1.
  __except(EXCEPTION_EXECUTE_HANDLER){
  printf("  In the exception handler.\n");
  ret = 1;
  }

// Report the value of the return code.
  printf("After __ud2().  Return code = %d.\n", ret);
  return ret;
}
Before __ud2(). Return code = 0.
  In the exception handler.
After __ud2().  Return code = 1.

Vedi anche

Intrinseci del compilatore