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 in MSDN
. 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 the DB
directive of MASM
. _emit
is an MSDN
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.
来源:https://stackoverflow.com/questions/16351352/in-c-programming-what-does-emit-do