Sdílet prostřednictvím


__ud2

Specifické pro Microsoft

Vygeneruje nedefinovanou instrukci.

Syntaxe

void __ud2();

Poznámky

Procesor vyvolá neplatnou výjimku opcode, pokud spustíte nedefinovanou instrukci.

Funkce __ud2 je ekvivalentní strojovému pokynu UD2 . Další informace naleznete v dokumentu "Intel Architecture Software Developer's Manual, Volume 2: Instruction Set Reference", na webu Společnosti Intel Corporation .

Požadavky

Vnitřní Architektura
__ud2 x86, x64

Hlavičkový soubor<intrin.h>

END Microsoft Specific

Příklad

Následující příklad spustí nedefinovanou instrukci, která vyvolá výjimku. Obslužná rutina výjimky pak změní návratový kód z nuly 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.

Viz také

Vnitřní funkce kompilátoru