有人可以解释xvi32 中 .o 文件的这个十六进制视图如何 对应于 .cpp 中的数据吗?即像'/18'/65'/139和“.rdata”这样的数字是什么意思?例如,当我打开相应的 exe 时,我看到文件非常相似,但略有不同,至少在这个开头。但特别是:为什么在 exe 中这个“.rdata”变成了“.data”?这是创建此 .o 的 .cpp :
// exercise_for.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <iterator>
#include <algorithm>
#include <fstream>
#include <limits>
struct myStruct{
int a;
double b;
virtual void func()=0;
void f(){};
};
struct sB{virtual void g()=0;};
struct myStruct2:sB{
void f(){};
void g(){std::cout<<"\nmyStruct2";}
};
struct myStruct3:sB{
void f(int const &in){a=in;};
void g(){std::cout<<"\nmyStruct3";};
myStruct3():a(0){};
int show(){return a;};
private:
int a;
};
class myC : public myStruct{
int i;
void func(){};
};
std::map<std::string,int> histogram;
void record(const std::string& in ){
histogram[in]++;
}
void print(const std::pair<const std::string,int>& in ){
std::cout<<(in.first)<<" "<<in.second<<"\n";
}
int _tmain(int argc, _TCHAR* argv[])
{
std::cout<<"largest float:"<<std::numeric_limits<float>::max()<<
"\nchar is signed:"<<std::numeric_limits<char>::is_signed<<
"\nlargest int:"<<std::numeric_limits<int>::max()<<
"\nlargest double:"<<std::numeric_limits<double>::max()<<
"\nlargest short int:"<<std::numeric_limits<short int>::max()<<
"\nlargest long int:"<<std::numeric_limits<long int>::max()<<"\n\n";
for(int i=0;i<10;++i){
std::cout<<++i;
}
myC mC;
myStruct2 m;
myStruct3 n;
std::cout<<"n: "<<n.show();
m.f();
n.f(4);
std::cout<<"\nn: "<<n.show();
std::cout<<"\nmem_fun";
std::list<sB*> myList;
myList.push_back(&m);
myList.push_back(&n);
std::for_each(myList.begin(),myList.end(),std::mem_fun(&sB::g));
std::list<sB*>::iterator it=myList.begin();
std::istream_iterator<std::string> ii(std::cin);
std::istream_iterator<std::string> eos;
std::for_each(ii,eos,record);
int i=0xffff;
std::string z;
std::cout<<"\n\nprinting: sizeof(int)="<<sizeof(int)<<" i:"<<i<<"\n";
int* i_ptr;
std::cout<<"sizeof(int*)="<<sizeof(i_ptr)<<"\n";
std::cout<<"sizeof(double)="<<sizeof(double)<<"\n";
std::cout<<"sizeof(double*)="<<sizeof(double*)<<"\n";
std::cout<<"sizeof(string)="<<sizeof(z)<<"\n";
float fl=1000+1.6+1.6+1.6+1.6;
std::cout<<"\nf:"<<fl;
std::for_each(histogram.begin(),histogram.end(),print);
std::vector<std::string> sL;
std::string s("spadaj");
sL.push_back(s);
std::copy(sL.begin(),sL.end(),std::ostream_iterator<std::string>(std::cout, " "));
std::ofstream f("myFile.txt");
std::copy(sL.begin(),sL.end(),std::ostream_iterator<std::string>(f, " "));
return 0;
}