回复 9楼 zklhp
我用sizeof求a和b的长度,都是2字节=16位,压出来32位的话是不是应该显示4字节啊?
程序代码:
0x004013b0 <main+0>: push ebp 0x004013b1 <main+1>: mov ebp,esp 0x004013b3 <main+3>: push ebx 0x004013b4 <main+4>: and esp,0xfffffff0 0x004013b7 <main+7>: sub esp,0x30 0x004013ba <main+10>: call 0x401a20 <__main> 0x004013bf <main+15>: mov WORD PTR [esp+0x2e],0xffff 0x004013c6 <main+22>: mov WORD PTR [esp+0x2c],0xfffe 0x004013cd <main+29>: movzx ebx,WORD PTR [esp+0x2e] 0x004013d2 <main+34>: movzx ecx,WORD PTR [esp+0x2e] 0x004013d7 <main+39>: movzx edx,WORD PTR [esp+0x2e] 0x004013dc <main+44>: movzx eax,WORD PTR [esp+0x2e] 0x004013e1 <main+49>: mov DWORD PTR [esp+0x10],ebx 0x004013e5 <main+53>: mov DWORD PTR [esp+0xc],ecx 0x004013e9 <main+57>: mov DWORD PTR [esp+0x8],edx 0x004013ed <main+61>: mov DWORD PTR [esp+0x4],eax 0x004013f1 <main+65>: mov DWORD PTR [esp],0x403064 0x004013f8 <main+72>: call 0x401c90 <printf> 0x004013fd <main+77>: movsx ebx,WORD PTR [esp+0x2c] 0x00401402 <main+82>: movsx ecx,WORD PTR [esp+0x2c] 0x00401407 <main+87>: movsx edx,WORD PTR [esp+0x2c] 0x0040140c <main+92>: movsx eax,WORD PTR [esp+0x2c] 0x00401411 <main+97>: mov DWORD PTR [esp+0x10],ebx 0x00401415 <main+101>: mov DWORD PTR [esp+0xc],ecx 0x00401419 <main+105>: mov DWORD PTR [esp+0x8],edx 0x0040141d <main+109>: mov DWORD PTR [esp+0x4],eax 0x00401421 <main+113>: mov DWORD PTR [esp],0x403074 0x00401428 <main+120>: call 0x401c90 <printf> 0x0040142d <main+125>: mov DWORD PTR [esp+0x28],0x2 0x00401435 <main+133>: mov DWORD PTR [esp+0x24],0x2 0x0040143d <main+141>: mov eax,DWORD PTR [esp+0x24] 0x00401441 <main+145>: mov DWORD PTR [esp+0x8],eax 0x00401445 <main+149>: mov eax,DWORD PTR [esp+0x28] 0x00401449 <main+153>: mov DWORD PTR [esp+0x4],eax 0x0040144d <main+157>: mov DWORD PTR [esp],0x403083 0x00401454 <main+164>: call 0x401c90 <printf> 0x00401459 <main+169>: mov eax,0x0 0x0040145e <main+174>: mov ebx,DWORD PTR [ebp-0x4] 0x00401461 <main+177>: leave 0x00401462 <main+178>: ret
可惜如果不懂汇编看不懂。。