C++程序员编码过程中经常会使用string(wstring)类,你是否思考过它的内部实现细节。比如这个类的迭代器是如何实现的?对象占多少字节的内存空间?内部有没有虚函数?内存是如何分配的?构造和析构的成本有多大?笔者综合这两天阅读的源代码及个人理解简要介绍之,错误的地方望读者指出。首先看看stri... Read More
posted @ 2015-11-30 06:19 findumars Views(3580) Comments(0) Diggs(0)
这几天写程序,无意间把编译中间文件给删了,然后就出现了C1083编译错误。xxx.cpp..\commen\xxx.cpp(2) : fatal error C1083: 无法打开预编译头文件:“Release\xxx.pch”: No such file or directory 在网... Read More
posted @ 2015-11-30 06:18 findumars Views(1345) Comments(0) Diggs(0)
Reference: http://www.wintellect.com/blogs/jrobbins/pdb-files-what-every-developer-must-know Most developers realize that PDB files are something that Read More
posted @ 2015-11-30 06:17 findumars Views(325) Comments(0) Diggs(0)
当 operator new 不能满足一个内存分配请求时,它抛出一个 exception(异常)。很久以前,他返回一个 null pointer(空指针),而一些比较老的编译器还在这样做。你依然能达到以前的目的(在一定程度上),但是我要到本文的最后再讨论它。 在 operator new 因回应一... Read More
posted @ 2015-11-30 06:15 findumars Views(1472) Comments(0) Diggs(0)
引言:C++中总共有三种方式可以分配内存,new operator, operator new,placement new。一,new operator这就是我们最常使用的 new 操作符。查看汇编码可以看出:它不是一个函数,所以没有堆栈信息,而且它不能被重载。请看下面一段代码:[cpp]view ... Read More
posted @ 2015-11-30 06:13 findumars Views(784) Comments(0) Diggs(0)