- 博客(7)
- 资源 (2)
- 收藏
- 关注
转载 学习用于异常处理的terminate()函数
异常处理是一个微妙的问题,你应该尽可能优雅地处理所有异常。要达到这个目的,你需要学习terminate()函数。terminate()函数在程序抛出一个异常并且异常没有被捕获的时候被调用,像下面这样:#include 〈exception〉#include 〈iostream〉void on_terminate(){std::cout 〈〈 "terminate
2009-03-12 02:02:00 700
转载 RTTI特性小究(dynamic_cast转换操作符和typeid操作符)
要使用RTTI特性,必须包含头文件,并且要使用/GR开启运行时信息,在visual studio中打开该项目的“属性页”对话框。有关详细信息,请参见如何:打开项目属性页。 单击“C/C++”文件夹。单击“语言”属性页。修改“启用运行时类型信息”属性。在g++中应该是在编译时使用命令/GR即可,(这个本人不是很确定,没实验过)先给一小段代码:
2009-03-12 01:40:00 451
转载 Overloading unary operators (C++ only)
You overload a unary operator with either a nonstatic member functionthat has no parameters, or a nonmember function that has one parameter. Supposea unary operator @ is called with the statem
2009-03-12 01:28:00 420
转载 Error Handling with C++ Exceptions, Part 1
by Chuck AllisonError Handling AlternativesWith the traditional programming languages of yore, a developers alternatives for handl
2009-03-11 22:42:00 461
转载 C++ 虚函数内存布局学习笔记
由sizeof()求带有虚函数的类的大小引发的思考,在查看相关资料的过程中看到了陈皓先生的一篇文章《C++ 虚函数表解析》(详情见http://blog.csdn.net/haoel)觉得讲的十分的好,只是看完之后仍对为什么要又为什么可以由父类的指针调用子类的对象的虚函数不解,如这种典型的描述:Derive d;//Derive 是Base的子类Base *b1 = &d;//这必须使
2009-03-11 20:15:00 575
转载 Using auto_ptr to Handle Memory
The auto_ptr template class is designed to help manage memory in asemi-automatic way and prevent memory leaks when unexpected events such asexceptions would otherwise have caused the normal cl
2009-03-11 10:21:00 309
转载 Casting in C++: Bringing Safety and Smartness to Your Programs
By G. Bowden Wise The new C++ standard is full of powerful additions to the language: templates, run-time type identification (RTTI), namespaces, and exc
2009-03-11 09:32:00 505
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人