user-0 提问: 关于C _asm的je指令问题求助

回复:
user: user-1
content: 引用 6 楼 zhao4zhong1 的回复:汇编标号不分大小写; c标号区分大小写。  是啊，所以这可以解释为什么goto c_dest;是Error而jmp c_dest是Legal的，以及为什么goto A_Dest;和goto a_dest;都是Legal的。 但是这并没有解释为什么goto a_dest;和jmp a_dest虽然是Legal但却是incorrect case。

user: user-2
content: 汇编标号不分大小写; c标号区分大小写。

user: user-1
content: 引用 4 楼 zhao4zhong1 的回复:还没见过谁敢说MSDN中的例子不对的。 然而这个例子就是睁眼说瞎话。  明明写的a_dest:    ; __asm label 却说jmp a_dest ; Legal: incorrect case是错误的大小写，都是完全一样的东西，这我就看不明白了。  而且更奇怪的是为什么jmp A_Dest又是正确的大小写了

user: user-2
content: 还没见过谁敢说MSDN中的例子不对的。  不要迷信书、考题、老师、回帖； 要迷信CPU、编译器、调试器、运行结果。 并请结合“盲人摸太阳”和“驾船出海时一定只带一个指南针。”加以理解。 任何理论、权威、传说、真理、标准、解释、想象、知识……都比不上摆在眼前的事实！

user: user-1
content: 引用 2 楼 zhao4zhong1 的回复:  Jumping to Labels in Inline Assembly Home |  Overview |  How Do I  Like an ordinary C or C++ label, a label in an __asm block has scope throughout the function in which it is defined (not only in the block). Both assembly instructions and goto statements can jump to labels inside or outside the __asm block.  Labels defined in __asm blocks are not case sensitive; both goto statements and assembly instructions can refer to those labels without regard to case. C and C++ labels are case sensitive only when used by goto statements. Assembly instructions can jump to a C or C++ label without regard to case.   The following code shows all the permutations:  void func( void ) {    goto C_Dest;  /* Legal: correct case   */    goto c_dest;  /* Error: incorrect case */     goto A_Dest;  /* Legal: correct case   */    goto a_dest;  /* Legal: incorrect case */     __asm    {       jmp C_Dest ; Legal: correct case       jmp c_dest ; Legal: incorrect case        jmp A_Dest ; Legal: correct case       jmp a_dest ; Legal: incorrect case        a_dest:    ; __asm label    }     C_Dest:       /* C label */     return; }  Don’t use C library function names as labels in __asm blocks. For instance, you might be tempted to use exit as a label, as follows:  ; BAD TECHNIQUE: using library function name as label jne exit    .    .    . exit:    ; More __asm code follows  Because exit is the name of a C library function, this code might cause a jump to the exit function instead of to the desired location.  As in MASM programs, the dollar symbol ($) serves as the current location counter. It is a label for the instruction currently being assembled. In __asm blocks, its main use is to make long conditional jumps:  jne $+5 ; next instruction is 5 bytes long jmp farlabel ; $+5    .    .    . farlabel:    感觉这个例子写错了吧。。为什么goto a_dest和jmp a_dest是错误的大小写？

user: user-2
content: Jumping to Labels in Inline Assembly Home |  Overview |  How Do I  Like an ordinary C or C++ label, a label in an __asm block has scope throughout the function in which it is defined (not only in the block). Both assembly instructions and goto statements can jump to labels inside or outside the __asm block.  Labels defined in __asm blocks are not case sensitive; both goto statements and assembly instructions can refer to those labels without regard to case. C and C++ labels are case sensitive only when used by goto statements. Assembly instructions can jump to a C or C++ label without regard to case.   The following code shows all the permutations:  void func( void ) {    goto C_Dest;  /* Legal: correct case   */    goto c_dest;  /* Error: incorrect case */     goto A_Dest;  /* Legal: correct case   */    goto a_dest;  /* Legal: incorrect case */     __asm    {       jmp C_Dest ; Legal: correct case       jmp c_dest ; Legal: incorrect case        jmp A_Dest ; Legal: correct case       jmp a_dest ; Legal: incorrect case        a_dest:    ; __asm label    }     C_Dest:       /* C label */     return; }  Don’t use C library function names as labels in __asm blocks. For instance, you might be tempted to use exit as a label, as follows:  ; BAD TECHNIQUE: using library function name as label jne exit    .    .    . exit:    ; More __asm code follows  Because exit is the name of a C library function, this code might cause a jump to the exit function instead of to the desired location.  As in MASM programs, the dollar symbol ($) serves as the current location counter. It is a label for the instruction currently being assembled. In __asm blocks, its main use is to make long conditional jumps:  jne $+5 ; next instruction is 5 bytes long jmp farlabel ; $+5    .    .    . farlabel:

user: user-0
content: 怎么才能让这段代码执行到je指令这里的时候跳到最后一段代码执行呢