Skip to content

Latest commit

 

History

History
41 lines (36 loc) · 1.57 KB

emit-pseudoinstruction.md

File metadata and controls

41 lines (36 loc) · 1.57 KB
title ms.custom ms.date ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
_emit Pseudoinstruction | Microsoft Docs
11/04/2016
cpp-tools
article
_emit
C++
byte defining (inline assembly)
_emit pseudoinstruction
004c48f3-364c-4e82-9a51-e326f9cc7b2b
11
corob-msft
corob
ghogen

_emit Pseudoinstruction

Microsoft Specific

The _emit pseudoinstruction defines one byte at the current location in the current text segment. The _emit pseudoinstruction resembles the DB directive of MASM.

The following fragment places the bytes 0x4A, 0x43, and 0x4B into the code:

#define randasm __asm _emit 0x4A __asm _emit 0x43 __asm _emit 0x4B  
 .  
 .  
 .  
__asm {  
     randasm  
     }  

Caution

If _emit generates instructions that modify registers, and you compile the application with optimizations, the compiler cannot determine what registers are affected. For example, if _emit generates an instruction that modifies the rax register, the compiler does not know that rax has changed. The compiler might then make an incorrect assumption about the value in that register after the inline assembler code executes. Consequently, your application might exhibit unpredictable behavior when it runs.

END Microsoft Specific

See Also

Using Assembly Language in __asm Blocks