摘要:三篇介绍动态链接库和静态链接库的博文:http://blog.csdn.net/gamecreating/article/details/5504152http://blog.csdn.net/firefoxbug/article/details/7326465http://www.cnblogs....
阅读全文
摘要:C++中的动态内存管理是通过new和delete两个操作符来完成的。new操作符,为对象分配内存并调用对象所属类的构造函数,返回一个指向该对象的指针。delete调用时,销毁对象,并释放对象所在的内存。但在程序中使用new和delete容易导致很多问题,这里列出三个比较容易犯的错误。我们new了一个...
阅读全文
摘要:#include #include using namespace std;class semaphore{private: mutex mtx; condition_variable cv; int count;public: semaphore(int count_ = ...
阅读全文
摘要:Visual Studio中/MD, /MT, /MDd, /MTd表示多线程模块是否为dll。对于这几个选项我的理解如下:/MD: 定义了_MT和_DLL,让程序用多线程和dll版本的运行库。/MT: 让程序用多线程和静态版本的运行库。/MDd: 定义了_MT、_DLL、_DEBUG,让程序用de...
阅读全文
摘要:1) Dequeue can quickly insert or delete both at the front or the end. However, vector can only quickly insert or delete at the end.2) Memory allocatio...
阅读全文
摘要:1 Local static variablesLocal static variables are not destroyed when the function ends; they are destroyed when the program terminates.2. Function pa...
阅读全文
摘要:1. Headers should not include using declarationCode inside headers ordinarily should not include using declarations. The reason is that the contents o...
阅读全文
摘要:1. Type conversion:If we assign an out-of-range value to an object of unsigned type, the result is the remainder of the value modulo the number of val...
阅读全文
摘要:写一个程序,结果总是不对,check逻辑好几遍也没发现错误,无奈之下debug。发现一个有趣的现象abs(INT_MAX-(-1))返回值是-2147483648。于是看了下abs函数的代码实现。1 int __cdecl abs (2 int number3 )4 ...
阅读全文
摘要:A declaration makes a name known to a programm. A definition creates the assocatied entity. A variable declaration specifies the variable type and nam...
阅读全文
摘要:Initialization happens when a variable is given a value at the moment it is created. Assignment obliterates the variable's current value and replace t...
阅读全文