摘要:
- **Why can I access private variables in the copy constructor?**The access modifiers work on **class level**, and not on object level.That is, two ob... 阅读全文
摘要:
*COPY FROM : [Stackoverflow](http://stackoverflow.com/questions/9162712/what-is-the-purpose-of-epolls-edge-triggered-option)*When an FD becomes read o... 阅读全文
摘要:
http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=2139751&page=1&authorid=7627362 阅读全文
摘要:
http://yehudakatz.com/2009/11/15/metaprogramming-in-ruby-its-all-about-the-self/ 阅读全文
摘要:
http://www.skorks.com/2010/04/on-the-value-of-fundamentals-in-software-development/ 阅读全文
摘要:
本篇文章摘抄于——http://stackoverflow.com/questions/470683/memory-allocation-deallocation-bottleneck,主要讲了C/C++堆内存分配和释放导致性能问题的原因,并给出了基本的解决方案。C/C++堆内存分配和释放,即通过malloc/free或new/delete操作内存,主要会引起两个问题:一是内存碎片;二是堆内存操作需多线程同步,加锁(OS级别)。============================================================================Q:How mu 阅读全文
摘要:
原贴请见:http://jinnsky2006.spaces.live.com/Blog/cns!27D75A3853CE1DBA!915.entry转载自:http://blog.csdn.net/fxpbupt/article/details/5600937----------------------------------------------------------------------------------------------------当定义一个命名空间时,可以省略命名空间的名称:1 namespce {2 char c;3 int i;4 dou... 阅读全文
摘要:
Python函数参数传递方式以及一致性我们首先来看两个示例:示例1:>>> a = 1>>> def func(b): b = 2>>> a1示例2:>>> a = [1]>>> def func(b): b.append(2)>>> func(a)>>> a[1, 2]我们发现在示例1中a所指向对象的值未被修改。而示例2中,a所指向对象的值却已经被修改了。我们进一步跟踪将发现,示例1中在“b = 2”语句执行后,a和b所指向的对象是不同的(id(a) != id(b) 阅读全文
摘要:
class ConnectionHandler{ bool is_conn_close_; Connection* conn_;public: explicit ConnectionHandler(Connection* conn): conn_(conn), is_conn_close_(false){} void Close() { try{ conn_ -> close(); } catch(...){ //... ... 阅读全文
摘要:
转自:http://stackoverflow.com/questions/395123/raii-and-smart-pointers-in-cA simple (and perhaps overused) example of RAII is a File class. Without RAII, the code might look something like this:File file("/path/to/file");// Do stuff with filefile.close();In other words, we must make sure tha 阅读全文