当在编写代码中用到异常,非常重要的一点是:“如果异常发生,程序占用的资源都被正确地清理了吗?”大多数情况下不用担心,但是在构造函数里有一个特殊的问题:如果一个对象的构造函数在执行过程中抛出异常,那么这个对象的析构函数就不会被调用。困难的事情是在构造函数中分配资源。如果在构造函数中发生异常,析构函数将没有机会释放这些资源。这个问题经常伴随着”悬挂“指针出现。例如:// Naked pointers.#include #include using namespace std;class Cat{public: Cat() {cout #include using namespace std... Read More
posted @ 2013-11-23 20:21 瓶哥 Views(487) Comments(0) Diggs(0) Edit
转载自:http://blog.csdn.net/wooin/article/details/1858917在原文基础上经过自己验证,修改和完善OS:Fedora19VIM:VIM7.4一、写在前面Linux下编程一直被诟病的一点是: 没有一个好用的IDE, 但是听说Linux牛人, 黑客之类的也都不用IDE. 但是对我等从Windows平台转移过来的Coder来说, 一个好用的IDE是何等的重要啊, 估计很多人就是卡在这个门槛上了, "工欲善其事, 必先利其器"嘛, 我想如果有一个很好用的IDE, 那些Linux牛人也会欢迎的. 这都是劳动人民的美好愿望罢了, 我今天教大 Read More
posted @ 2013-11-23 12:48 瓶哥 Views(529) Comments(0) Diggs(0) Edit
在屏幕上画简单图形和显示图片、处理简单鼠标键盘事件/*************************************************************** * Name: MyApp.h * Purpose: Defines Application Class * Author: PingGe (414236069@qq.com) * Created: 2013-10-14 * Copyright: PingGe (http://www.cnblogs.com/pingge/) * License: ***********************... Read More
posted @ 2013-11-23 11:00 瓶哥 Views(1781) Comments(0) Diggs(0) Edit
/*************************************************************** * Name: MyApp.h * Purpose: Defines MyApp Class * Author: PingGe (414236069@qq.com) * Created: 2013-10-19 * Copyright: PingGe (http://www.cnblogs.com/pingge/) * License: ******************************************************... Read More
posted @ 2013-11-23 10:50 瓶哥 Views(1197) Comments(0) Diggs(0) Edit