能力值:
( LV2,RANK:10 )
2 楼
难道是编译器做的???
784A9752 68 9C214878 push MSVCP90.7848219C ; ASCII "ld" //有符号是的这个
784A9757 8D45 F4 lea eax,dword ptr ss:[ebp-C]
784A975A 8BD9 mov ebx,ecx
784A975C 50 push eax
784A975D 53 push ebx
784A975E E8 1C4AFEFF call MSVCP90.std::num_put<wchar_t,std:>
784A9763 83C4 10 add esp,10
784A9766 50 push eax
784A9767 8D45 B4 lea eax,dword ptr ss:[ebp-4C]
784A976A 6A 40 push 40
784A976C 50 push eax
784A976D FF15 EC104878 call dword ptr ds:[<&MSVCR90.sprintf_s>; MSVCR90.sprintf_s
784A9773 50 push eax
784A9752 68 9C214878 push MSVCP90.7848219C ; ASCII "lu" //无符号是这个
784A9757 8D45 F4 lea eax,dword ptr ss:[ebp-C]
784A975A 8BD9 mov ebx,ecx
784A975C 50 push eax
784A975D 53 push ebx
784A975E E8 1C4AFEFF call MSVCP90.std::num_put<wchar_t,std:>
784A9763 83C4 10 add esp,10
784A9766 50 push eax
784A9767 8D45 B4 lea eax,dword ptr ss:[ebp-4C]
784A976A 6A 40 push 40
784A976C 50 push eax
784A976D FF15 EC104878 call dword ptr ds:[<&MSVCR90.sprintf_s>; MSVCR90.sprintf_s
784A9773 50 push eax
前面的内存地址不是一样的,我是为了图方便,直接改的。。这段代码是vc库函数已经准备好的。。具体以什么为依据跑过来的还不清楚。
能力值:
( LV5,RANK:66 )
3 楼
我这里显示一样,不知道你怎么就不一样了
能力值:
( LV2,RANK:10 )
4 楼
呵。有意思,应该是编译器搞的。
能力值:
( LV2,RANK:10 )
5 楼
你单独编译。。。
这个是无符号的
00401011 |. A1 40204000 mov eax,dword ptr ds:[<&MSVCP90.std::e>
00401016 |. 8B0D 3820400>mov ecx,dword ptr ds:[<&MSVCP90.std::c>; MSVCP90.std::cout
0040101C |. 50 push eax ;
0040101D |. 6A FF push -1 ; 初始化变量
0040101F |. FF15 4420400>call dword ptr ds:[<&MSVCP90.std::basi>; 这里就是格式化输出了,跳到内存地址,指针指向:0x784ABBED
00401025 |. 8BC8 mov ecx,eax
00401027 |. FF15 3C20400>call dword ptr ds:[<&MSVCP90.std::basi>; MSVCP90.std::basic_ostream<wchar_t,std::char_traits<wchar_t> >::operator<<
0040102D |. 68 20214000 push 无符号.00402120 ; /command = "pause"
0040101C |. 50 push eax ; MSVCP90.std::endl
0040101D |. 6A FF push -1 ; 初始化
0040101F |. FF15 4420400>call dword ptr ds:[<&MSVCP90.std::basic_ostream<c>; 这里的内存地址是:0x784ABCD1
00401025 |. 8BC8 mov ecx,eax
能力值:
( LV3,RANK:20 )
6 楼
在处理数据时是靠相关cpu指令是有符号还是无符号的来分,比如无符号数除法指令DIV和有符号数除法指令IDIV,而数据在内存中的存储是不分的
能力值:
( LV2,RANK:10 )
7 楼
代码
#include <iostream>
using namespace std;
void main()
{
int a =0xFFFFFFFF; //-1
//unsigned int a = 0xFFFFFFFF; //4294967295
cout<<a<<endl;
}
无符号
4: void main()
5: {
00401560 push ebp
00401561 mov ebp,esp
00401563 sub esp,44h
00401566 push ebx
00401567 push esi
00401568 push edi
00401569 lea edi,[ebp-44h]
0040156C mov ecx,11h
00401571 mov eax,0CCCCCCCCh
00401576 rep stos dword ptr [edi]
6: // int a =0xFFFFFFFF; //-1
7: unsigned int a = 0xFFFFFFFF; //4294967295
00401578 mov dword ptr [ebp-4],0FFFFFFFFh
8: cout<<a<<endl;
0040157F push offset @ILT+195(std::endl) (004010c8)
00401584 mov eax,dword ptr [ebp-4]
00401587 push eax
00401588 mov ecx,offset std::cout (0047be90)
0040158D call @ILT+250(std::basic_ostream<char,std::char_traits<char> >::operator<<) (004010ff)
00401592 mov ecx,eax
00401594 call @ILT+475(std::basic_ostream<char,std::char_traits<char> >::operator<<) (004011e0)
9: }
有符号
4: void main()
5: {
00401560 push ebp
00401561 mov ebp,esp
00401563 sub esp,44h
00401566 push ebx
00401567 push esi
00401568 push edi
00401569 lea edi,[ebp-44h]
0040156C mov ecx,11h
00401571 mov eax,0CCCCCCCCh
00401576 rep stos dword ptr [edi]
6: int a =0xFFFFFFFF; //-1
00401578 mov dword ptr [ebp-4],0FFFFFFFFh
7: //unsigned int a = 0xFFFFFFFF; //4294967295
8: cout<<a<<endl;
0040157F push offset @ILT+195(std::endl) (004010c8)
00401584 mov eax,dword ptr [ebp-4]
00401587 push eax
00401588 mov ecx,offset std::cout (0047be90)
0040158D call @ILT+250(std::basic_ostream<char,std::char_traits<char> >::operator<<) (004010ff)
00401592 mov ecx,eax
00401594 call @ILT+475(std::basic_ostream<char,std::char_traits<char> >::operator<<) (004011e0)
9: }
能力值:
( LV2,RANK:10 )
8 楼
VC 6.0 编译 ,无 雪yaojun 说的现象。
能力值:
( LV2,RANK:10 )
9 楼
vs2008
我说的地址不是用户区的地址,是CALL的指针指向的地址。。你往我说的那个CALL跟进去看看不就知道了
能力值:
( LV2,RANK:10 )
10 楼
我vs 2010 测试的确地址不同 call还没看。要上班了.但VC的call地址好像一样的为什么?