__ud2

Specyficzne dla firmy Microsoft

Generuje niezdefiniowaną instrukcję.

Składnia

void __ud2();

Uwagi

Procesor zgłasza nieprawidłowy wyjątek kodu opcode, jeśli wykonasz niezdefiniowaną instrukcję.

Funkcja jest równoważna __ud2 instrukcji UD2 maszyny. Aby uzyskać więcej informacji, wyszukaj dokument "Intel Architecture Software Developer's Manual, Volume 2: Instruction Set Reference", w witrynie Firmy Intel Corporation .

Wymagania

Wewnętrzne Architektura
__ud2 x86, x64

Plik<nagłówka intrin.h>

END Microsoft Specific

Przykład

Poniższy przykład wykonuje niezdefiniowaną instrukcję, która zgłasza wyjątek. Procedura obsługi wyjątków zmienia następnie kod powrotny z zera na jeden.

// __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.

Zobacz też

Funkcje wewnętrzne kompilatora