I recently tried to expand my knowledge of the C language and I came across a program that used emit, to possibly emit a byte.
__declspec(naked) void marker_begin() {
__asm {
_emit 0x51;
_emit 0x21;
_emit 0x1A;
_emit 0x14;
_emit 0x2C;
_emit 0x5B;
}
}
What could this be used for? Thanks in advance.
Your C program is executing inline assembly code by using the
_asm
keyword. _asm is a Microsoft specific keyword used inMSDN
. The__asm
keyword invokes the inline assembler. It must be followed by an assembly instruction, a group of instructions enclosed in braces, or, at least, an empty pair of braces.The
_emit
pseudo instruction is similar to theDB
directive ofMASM
._emit
is anMSDN
specific pseudo instruction._emit
is used to define a single immediate byte at the current location in the current text segment._emit
can define only one byte at a time and only in the text segment.