Edit

Share via


_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