﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-MySpace</title><link>http://www.cppblog.com/yang-chunlei/</link><description /><language>zh-cn</language><lastBuildDate>Mon, 13 Apr 2026 09:42:01 GMT</lastBuildDate><pubDate>Mon, 13 Apr 2026 09:42:01 GMT</pubDate><ttl>60</ttl><item><title>转载一篇关于模板的文章</title><link>http://www.cppblog.com/yang-chunlei/archive/2009/07/09/89691.html</link><dc:creator>yang-chunlei</dc:creator><author>yang-chunlei</author><pubDate>Thu, 09 Jul 2009 14:33:00 GMT</pubDate><guid>http://www.cppblog.com/yang-chunlei/archive/2009/07/09/89691.html</guid><wfw:comment>http://www.cppblog.com/yang-chunlei/comments/89691.html</wfw:comment><comments>http://www.cppblog.com/yang-chunlei/archive/2009/07/09/89691.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yang-chunlei/comments/commentRss/89691.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yang-chunlei/services/trackbacks/89691.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 如何组织编写模板程序 <br><br>前言<br>常遇到询问使用模板到底是否容易的问题，我的回答是：“模板的使用是容易的，但组织编写却不容易”。看看我们几乎每天都能遇到的模板类吧，如STL, ATL, WTL, 以及Boost的模板类，都能体会到这样的滋味：接口简单，操作复杂。&nbsp;&nbsp;<a href='http://www.cppblog.com/yang-chunlei/archive/2009/07/09/89691.html'>阅读全文</a><img src ="http://www.cppblog.com/yang-chunlei/aggbug/89691.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yang-chunlei/" target="_blank">yang-chunlei</a> 2009-07-09 22:33 <a href="http://www.cppblog.com/yang-chunlei/archive/2009/07/09/89691.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用 fork 所要注意的</title><link>http://www.cppblog.com/yang-chunlei/archive/2008/12/23/70158.html</link><dc:creator>yang-chunlei</dc:creator><author>yang-chunlei</author><pubDate>Tue, 23 Dec 2008 06:22:00 GMT</pubDate><guid>http://www.cppblog.com/yang-chunlei/archive/2008/12/23/70158.html</guid><wfw:comment>http://www.cppblog.com/yang-chunlei/comments/70158.html</wfw:comment><comments>http://www.cppblog.com/yang-chunlei/archive/2008/12/23/70158.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cppblog.com/yang-chunlei/comments/commentRss/70158.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yang-chunlei/services/trackbacks/70158.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: fork 的时候所应该注意的问题。在我们需要一个程序成为后台的守护进程时，一般是通过fork 来创建一个子进程，随之父进程结束，然后再通过 setsid 来使子进程脱离父进程所属的进程组和会话。&nbsp;&nbsp;<a href='http://www.cppblog.com/yang-chunlei/archive/2008/12/23/70158.html'>阅读全文</a><img src ="http://www.cppblog.com/yang-chunlei/aggbug/70158.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yang-chunlei/" target="_blank">yang-chunlei</a> 2008-12-23 14:22 <a href="http://www.cppblog.com/yang-chunlei/archive/2008/12/23/70158.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于GCC的变量入棧和 sizeof()函数</title><link>http://www.cppblog.com/yang-chunlei/archive/2008/08/14/58854.html</link><dc:creator>yang-chunlei</dc:creator><author>yang-chunlei</author><pubDate>Thu, 14 Aug 2008 09:42:00 GMT</pubDate><guid>http://www.cppblog.com/yang-chunlei/archive/2008/08/14/58854.html</guid><wfw:comment>http://www.cppblog.com/yang-chunlei/comments/58854.html</wfw:comment><comments>http://www.cppblog.com/yang-chunlei/archive/2008/08/14/58854.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yang-chunlei/comments/commentRss/58854.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yang-chunlei/services/trackbacks/58854.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 先说简单的：<br><br>像这样 int i = 0; 的语句编译器会将变量 i 放入棧中，当过了它的作用域之后会自动释放它在棧中所占的空间。<br>再有：我们定义了一个类 A ，然后执行语句 A a = new A; 那么 a 这个变量就被编译器丢到了堆中。<br>此时 a 中所占的空间只能靠我们自己释放。<br>&nbsp;&nbsp;<a href='http://www.cppblog.com/yang-chunlei/archive/2008/08/14/58854.html'>阅读全文</a><img src ="http://www.cppblog.com/yang-chunlei/aggbug/58854.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yang-chunlei/" target="_blank">yang-chunlei</a> 2008-08-14 17:42 <a href="http://www.cppblog.com/yang-chunlei/archive/2008/08/14/58854.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>又想起了malloc 与 free </title><link>http://www.cppblog.com/yang-chunlei/archive/2008/08/05/58096.html</link><dc:creator>yang-chunlei</dc:creator><author>yang-chunlei</author><pubDate>Tue, 05 Aug 2008 15:00:00 GMT</pubDate><guid>http://www.cppblog.com/yang-chunlei/archive/2008/08/05/58096.html</guid><wfw:comment>http://www.cppblog.com/yang-chunlei/comments/58096.html</wfw:comment><comments>http://www.cppblog.com/yang-chunlei/archive/2008/08/05/58096.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yang-chunlei/comments/commentRss/58096.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yang-chunlei/services/trackbacks/58096.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 又想起了malloc 与 free <br><br>&nbsp;&nbsp;<a href='http://www.cppblog.com/yang-chunlei/archive/2008/08/05/58096.html'>阅读全文</a><img src ="http://www.cppblog.com/yang-chunlei/aggbug/58096.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yang-chunlei/" target="_blank">yang-chunlei</a> 2008-08-05 23:00 <a href="http://www.cppblog.com/yang-chunlei/archive/2008/08/05/58096.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>异常的抛出</title><link>http://www.cppblog.com/yang-chunlei/archive/2008/06/19/53968.html</link><dc:creator>yang-chunlei</dc:creator><author>yang-chunlei</author><pubDate>Thu, 19 Jun 2008 01:55:00 GMT</pubDate><guid>http://www.cppblog.com/yang-chunlei/archive/2008/06/19/53968.html</guid><wfw:comment>http://www.cppblog.com/yang-chunlei/comments/53968.html</wfw:comment><comments>http://www.cppblog.com/yang-chunlei/archive/2008/06/19/53968.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yang-chunlei/comments/commentRss/53968.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yang-chunlei/services/trackbacks/53968.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 异常的抛出<br><br>异常可以通过 throw 抛出，比如我定义一个函数别的不做只管抛出异常<br><br>先定义一个异常类<br><br>class Ex1<br>{<br>public: <br>	string getString()<br>	{<br>		return "Ex1 ERROR!";<br>	}<br>};&nbsp;&nbsp;<a href='http://www.cppblog.com/yang-chunlei/archive/2008/06/19/53968.html'>阅读全文</a><img src ="http://www.cppblog.com/yang-chunlei/aggbug/53968.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yang-chunlei/" target="_blank">yang-chunlei</a> 2008-06-19 09:55 <a href="http://www.cppblog.com/yang-chunlei/archive/2008/06/19/53968.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>malloc 与 free 的点滴</title><link>http://www.cppblog.com/yang-chunlei/archive/2008/06/18/53868.html</link><dc:creator>yang-chunlei</dc:creator><author>yang-chunlei</author><pubDate>Wed, 18 Jun 2008 07:51:00 GMT</pubDate><guid>http://www.cppblog.com/yang-chunlei/archive/2008/06/18/53868.html</guid><wfw:comment>http://www.cppblog.com/yang-chunlei/comments/53868.html</wfw:comment><comments>http://www.cppblog.com/yang-chunlei/archive/2008/06/18/53868.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yang-chunlei/comments/commentRss/53868.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yang-chunlei/services/trackbacks/53868.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: malloc负责在堆上申请一块内存并返回一个指向该内存块的 void 类型的指针， free负责释放掉该指针指向的内存块。&nbsp;&nbsp;<a href='http://www.cppblog.com/yang-chunlei/archive/2008/06/18/53868.html'>阅读全文</a><img src ="http://www.cppblog.com/yang-chunlei/aggbug/53868.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yang-chunlei/" target="_blank">yang-chunlei</a> 2008-06-18 15:51 <a href="http://www.cppblog.com/yang-chunlei/archive/2008/06/18/53868.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C++ 的隐式转换</title><link>http://www.cppblog.com/yang-chunlei/archive/2008/06/17/53770.html</link><dc:creator>yang-chunlei</dc:creator><author>yang-chunlei</author><pubDate>Tue, 17 Jun 2008 14:50:00 GMT</pubDate><guid>http://www.cppblog.com/yang-chunlei/archive/2008/06/17/53770.html</guid><wfw:comment>http://www.cppblog.com/yang-chunlei/comments/53770.html</wfw:comment><comments>http://www.cppblog.com/yang-chunlei/archive/2008/06/17/53770.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/yang-chunlei/comments/commentRss/53770.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yang-chunlei/services/trackbacks/53770.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:   当我们在函数声明中型参类型与我们输入的实参类型不一致时编译器会依据怎样的原则进行处理呢。首先是将实参进行类型转换，若类型转换失败，则编译器会进行错误提示。进行类型转换时需要使用类型转换函数，那根据怎么样顺序来找出合适的函数呢?这个顺序的规则是非常复杂的，但并不是说因为复杂我们就无法判断了。我们来让代码说话。&nbsp;&nbsp;<a href='http://www.cppblog.com/yang-chunlei/archive/2008/06/17/53770.html'>阅读全文</a><img src ="http://www.cppblog.com/yang-chunlei/aggbug/53770.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yang-chunlei/" target="_blank">yang-chunlei</a> 2008-06-17 22:50 <a href="http://www.cppblog.com/yang-chunlei/archive/2008/06/17/53770.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>动态绑定与静态绑定</title><link>http://www.cppblog.com/yang-chunlei/archive/2008/06/06/52334.html</link><dc:creator>yang-chunlei</dc:creator><author>yang-chunlei</author><pubDate>Fri, 06 Jun 2008 02:57:00 GMT</pubDate><guid>http://www.cppblog.com/yang-chunlei/archive/2008/06/06/52334.html</guid><wfw:comment>http://www.cppblog.com/yang-chunlei/comments/52334.html</wfw:comment><comments>http://www.cppblog.com/yang-chunlei/archive/2008/06/06/52334.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yang-chunlei/comments/commentRss/52334.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yang-chunlei/services/trackbacks/52334.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:     一切皆因虚函数的默认参数而起。当基类的虚函数中参数默认值与派生类中相应函数的参数默认值不相同时会发生什么样的情况？&nbsp;&nbsp;<a href='http://www.cppblog.com/yang-chunlei/archive/2008/06/06/52334.html'>阅读全文</a><img src ="http://www.cppblog.com/yang-chunlei/aggbug/52334.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yang-chunlei/" target="_blank">yang-chunlei</a> 2008-06-06 10:57 <a href="http://www.cppblog.com/yang-chunlei/archive/2008/06/06/52334.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>自动创建的拷贝构造函数</title><link>http://www.cppblog.com/yang-chunlei/archive/2008/06/05/52254.html</link><dc:creator>yang-chunlei</dc:creator><author>yang-chunlei</author><pubDate>Thu, 05 Jun 2008 08:21:00 GMT</pubDate><guid>http://www.cppblog.com/yang-chunlei/archive/2008/06/05/52254.html</guid><wfw:comment>http://www.cppblog.com/yang-chunlei/comments/52254.html</wfw:comment><comments>http://www.cppblog.com/yang-chunlei/archive/2008/06/05/52254.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yang-chunlei/comments/commentRss/52254.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yang-chunlei/services/trackbacks/52254.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 当自定义的类中没有定义拷贝构造函数是，编译器会自动为这个类创建一个。&nbsp;&nbsp;<a href='http://www.cppblog.com/yang-chunlei/archive/2008/06/05/52254.html'>阅读全文</a><img src ="http://www.cppblog.com/yang-chunlei/aggbug/52254.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yang-chunlei/" target="_blank">yang-chunlei</a> 2008-06-05 16:21 <a href="http://www.cppblog.com/yang-chunlei/archive/2008/06/05/52254.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>禁止隐式生成函数</title><link>http://www.cppblog.com/yang-chunlei/archive/2008/06/05/52221.html</link><dc:creator>yang-chunlei</dc:creator><author>yang-chunlei</author><pubDate>Thu, 05 Jun 2008 02:11:00 GMT</pubDate><guid>http://www.cppblog.com/yang-chunlei/archive/2008/06/05/52221.html</guid><wfw:comment>http://www.cppblog.com/yang-chunlei/comments/52221.html</wfw:comment><comments>http://www.cppblog.com/yang-chunlei/archive/2008/06/05/52221.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/yang-chunlei/comments/commentRss/52221.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yang-chunlei/services/trackbacks/52221.html</trackback:ping><description><![CDATA[如何禁止隐式生成函数？比如当一个类中没有重写拷贝函数，那么编译器会隐式的为它生成一个，但此时我不想要它，我只想一旦有人调用该类的拷贝函数时编译就出错。那么我可以自己定义一个拷贝函数，并将它设置为私有的，那么外部显然是不能调用的。但是如果有内部的成员函数要是调用到了那该方法就不起作用了，此时我将拷贝函数修改一下，让它只有声明没有定义。这下问题应该解决了吧，呵呵。
<img src ="http://www.cppblog.com/yang-chunlei/aggbug/52221.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yang-chunlei/" target="_blank">yang-chunlei</a> 2008-06-05 10:11 <a href="http://www.cppblog.com/yang-chunlei/archive/2008/06/05/52221.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>