How do I write the following inline Assembly Code in C using GCC
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I was reading some answers and questions on here and kept coming up with this suggestion but I noticed no one ever actually explained "exactly" what you need to do to do it, On Windows using Intel and GCC compiler. Commented below is exactly what I am trying to do. #include int main() { int x = 1; int y = 2; //assembly code begin /* push x into stack; 回答1: Let the compiler choose the registers, using the k prefix to denote a 32-bit register for the int type (so it works as expected on x86-64) : __asm__ ("pushl %k0\n\t" "movl %k1, %k0\n\t"