C#中非主流的换值方法
时间:2011-04-22 来源:阿森纳
今天在csdn看见个人提问
1:
int a = 1, b = 2;a = b + (b = a) * 0; 1 mov dword ptr [ebp-44h],1
2 mov dword ptr [ebp-48h],2
3
4 mov eax,dword ptr [ebp-48h]
5 mov dword ptr [ebp-58h],eax
6 mov eax,dword ptr [ebp-44h]
7 mov dword ptr [ebp-48h],eax
8 mov eax,dword ptr [ebp-58h]
9 mov dword ptr [ebp-44h],eax
2: int c = 2, d = 1;
int f = c;
c = d;
d = f; 1 mov dword ptr [ebp-4Ch],2
2 mov dword ptr [ebp-50h],1
3
4 mov eax,dword ptr [ebp-4Ch]
5 mov dword ptr [ebp-54h],eax
6 mov eax,dword ptr [ebp-50h]
7 mov dword ptr [ebp-4Ch],eax
8 mov eax,dword ptr [ebp-54h]
9 mov dword ptr [ebp-50h],eax
很奇怪第一个例子的加号和乘号哪去了? 这样就完成了换值
出这题的人真是个高手啊
相关阅读 更多 +