In C programming, what does “emit” do?

别等时光非礼了梦想. 提交于 2019-12-21 22:19:02

问题


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.


回答1:


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!