对 goto 不太理解
汇编吧
全部回复
仅看楼主
level 6
int20 楼主
#include <stdio.h>
int main()
{
goto part1;
part1: int i;
printf("\n");
return 0;
}
这是源程序。
2016年01月09日 07点01分 1
level 6
int20 楼主
4: goto part1;
0040FA38 jmp part1+11h (0040fa4b)
5: part1: int i;
6: printf("\n");
0040FA3A push offset string "\n" (0042201c)
0040FA3F call printf (004010c0)
0040FA44 add esp,4
7: return 0;
0040FA47 xor eax,eax
0040FA49 jmp part1+13h (0040fa4d)
8: }
0040FA4B jmp part1 (0040fa3a)
这是反汇编,
goto part1;
0040FA38 jmp part1+11h (0040fa4b)
这句从字面上理解,不应该跳到fa3a么,怎么跳到最后去了。
2016年01月09日 07点01分 2
level 12
这是一个任性的编译器,就是这样。
2016年01月09日 08点01分 3
level 7
好像if, while 都是跳到后面,然后加以判断,在跳回去。
2016年01月10日 02点01分 5
1