visual C++ template 对应的汇编码的问题

来源:百度知道 编辑:UC知道 时间:2024/06/20 04:28:49
如下的C++程序
#include <vector>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{

vector<int> vec0;
const int size = 8;
const int value = 1024;
vector<int> vec1 (size);
vector<int> vec2 (size,value);
int ia[4] = { 0,1,2,3};
vector<int> vec3 (ia,ia+4);
vector<int> vec4(vec2);
vector<int> vec5(vec4);

return 0;
}
对应的VC汇编码如下
// Cpp001.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <string>
#include <vector>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
00411920 push ebp
00411921 mov ebp,esp
00411923 push 0FFFFFFFFh
00411925 push offset __ehhandler$_wmain (41978Eh)
0041192A mov eax,dword ptr fs:[00000000h]
00

应该是debug模式里的垃圾代码

不过看release的反汇编呢,被优化的又太多。

现在学这些的人有点少了,孩子,你很不错!

不错