<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>大卫的思维空间</title><link>http://blog.vckbase.com/billdavid/</link><description>自由的国度，思维的空间......</description><managingEditor>大卫的思维空间</managingEditor><dc:language>af</dc:language><generator>.Text Version 0.958.2004.214</generator><item><dc:creator>大卫的思维空间</dc:creator><title>关于std::stringsteam的clear与str方法</title><link>http://blog.vckbase.com/billdavid/archive/2009/02/17/36422.html</link><pubDate>Tue, 17 Feb 2009 02:57:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2009/02/17/36422.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/36422.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2009/02/17/36422.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/36422.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/36422.html</trackback:ping><description>关于std::stringsteam的clear与str方法在使用中需要注意的问题。&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/36422.html" width = "1" height = "1" /&gt;</description></item><item><dc:creator>大卫的思维空间</dc:creator><title>Java RPC通信机制之SOAP：应用Apache Axis进行Web Service开发</title><link>http://blog.vckbase.com/billdavid/archive/2006/08/18/21982.html</link><pubDate>Fri, 18 Aug 2006 14:42:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2006/08/18/21982.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/21982.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2006/08/18/21982.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/21982.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/21982.html</trackback:ping><description>SOAP原意为Simple Object Access Protocol（简单对象访问协议），是一个用于分布式环境的、轻量级的、基于XML进行信息交换的通信协议。本文以Apache Axis 1.4为基础，讨论了SOAP开发Web Service的基本内容。&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/21982.html" width = "1" height = "1" /&gt;</description></item><item><dc:creator>大卫的思维空间</dc:creator><title>Java RPC通信机制之XML-RPC：Apache XML-RPC 3.0开发简介</title><link>http://blog.vckbase.com/billdavid/archive/2006/08/18/21981.html</link><pubDate>Fri, 18 Aug 2006 14:35:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2006/08/18/21981.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/21981.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2006/08/18/21981.html#Feedback</comments><slash:comments>9</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/21981.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/21981.html</trackback:ping><description>XML-RPC是一种简单的，轻量级的通过HTTP协议进行RPC通信的规范。本文以Apache XML-RPC 3.0为基础，对XML-RPC的基本原理及Apache XML-RPC 3.0的主要特性进行了讨论和分析。

&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/21981.html" width = "1" height = "1" /&gt;</description></item><item><dc:creator>大卫的思维空间</dc:creator><title>Java RPC通信机制之RMI</title><link>http://blog.vckbase.com/billdavid/archive/2006/08/18/21980.html</link><pubDate>Fri, 18 Aug 2006 14:33:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2006/08/18/21980.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/21980.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2006/08/18/21980.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/21980.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/21980.html</trackback:ping><description>简要介绍Java RPC通信机制RMI的基本原理，应用过程中可能遇到的问题及其解决办法。&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/21980.html" width = "1" height = "1" /&gt;</description></item><item><dc:creator>大卫的思维空间</dc:creator><title>体验CORBA组件模型CCM：2、实例</title><link>http://blog.vckbase.com/billdavid/archive/2006/05/18/20161.html</link><pubDate>Thu, 18 May 2006 00:52:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2006/05/18/20161.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/20161.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2006/05/18/20161.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/20161.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/20161.html</trackback:ping><description>通过一个简单的实例，详细介绍基于CIAO的CCM组件开发过程。&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/20161.html" width = "1" height = "1" /&gt;</description></item><item><dc:creator>大卫的思维空间</dc:creator><title>体验CORBA组件模型CCM：1、引言</title><link>http://blog.vckbase.com/billdavid/archive/2006/05/18/20160.html</link><pubDate>Thu, 18 May 2006 00:47:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2006/05/18/20160.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/20160.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2006/05/18/20160.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/20160.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/20160.html</trackback:ping><description>在比较CORBA2.x与CORBA3.x的基础上，简要介绍CCM引入的新特性。&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/20160.html" width = "1" height = "1" /&gt;</description></item><item><dc:creator>大卫的思维空间</dc:creator><title>CORBA Programming with TAO - 9.Postscript（后记）</title><link>http://blog.vckbase.com/billdavid/archive/2006/05/12/20037.html</link><pubDate>Fri, 12 May 2006 09:34:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2006/05/12/20037.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/20037.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2006/05/12/20037.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/20037.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/20037.html</trackback:ping><description>这是整个系列的最后一篇，对整个系列及该系列未涵盖的内容进行了总结，同时对CORBA及分布式对象计算技术的发展状况进行了简单分析。&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/20037.html" width = "1" height = "1" /&gt;</description></item><item><dc:creator>大卫的思维空间</dc:creator><title>CORBA Programming with TAO - 8.Event Service（事件服务）</title><link>http://blog.vckbase.com/billdavid/archive/2006/05/12/20036.html</link><pubDate>Fri, 12 May 2006 09:31:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2006/05/12/20036.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/20036.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2006/05/12/20036.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/20036.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/20036.html</trackback:ping><description>事件服务（Event Service）通过在通信的双方甚至是多方间引入一个第三方――Event Channel，一定程度上解除Client和Server之间的耦合关系，在通信的过程中，任意一方只需与Event Channel打交道，而无需确切知道对方的存在，从而使得二者由一对一的关系变成多对多的关系。&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/20036.html" width = "1" height = "1" /&gt;</description></item><item><dc:creator>大卫的思维空间</dc:creator><title>CORBA Programming with TAO - 7.IIOP（体验IIOP－－一个Java作客户端的例子）</title><link>http://blog.vckbase.com/billdavid/archive/2006/05/12/20035.html</link><pubDate>Fri, 12 May 2006 09:29:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2006/05/12/20035.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/20035.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2006/05/12/20035.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/20035.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/20035.html</trackback:ping><description>CORBA2.0引入的IIOP（Internet Inter-ORB Protocol）是GIOP（General Inter-ORB Protocol）针对TCP/IP协议的一个实现，IIOP使得不同ORB间可以相互访问，同时也使得基于不同ORB的复杂分布式应用成为可能。&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/20035.html" width = "1" height = "1" /&gt;</description></item><item><dc:creator>大卫的思维空间</dc:creator><title>CORBA Programming with TAO - 6.Naming Service（使用命名服务）</title><link>http://blog.vckbase.com/billdavid/archive/2006/05/12/20034.html</link><pubDate>Fri, 12 May 2006 09:26:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2006/05/12/20034.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/20034.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2006/05/12/20034.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/20034.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/20034.html</trackback:ping><description>命名服务（Naming Service）是CORBA定义的诸多服务中比较常用的一个， Naming Service提供的助记符解析服务使得应用程序可以借助助记符，而不是一大串IOR来访问到相应的Servant。&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/20034.html" width = "1" height = "1" /&gt;</description></item><item><dc:creator>大卫的思维空间</dc:creator><title>CORBA Programming with TAO - 5.Hello World（简单实例）</title><link>http://blog.vckbase.com/billdavid/archive/2006/05/12/20033.html</link><pubDate>Fri, 12 May 2006 09:22:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2006/05/12/20033.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/20033.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2006/05/12/20033.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/20033.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/20033.html</trackback:ping><description>前面对CORBA编程的基础知识进行了简单介绍，本篇中，我们将实例讲解如何利用TAO中进行CORBA编程。&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/20033.html" width = "1" height = "1" /&gt;</description></item><item><dc:creator>大卫的思维空间</dc:creator><title>CORBA Programming with TAO - 4.Basic Functions（常用基本方法解析）</title><link>http://blog.vckbase.com/billdavid/archive/2006/05/12/20032.html</link><pubDate>Fri, 12 May 2006 09:16:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2006/05/12/20032.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/20032.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2006/05/12/20032.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/20032.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/20032.html</trackback:ping><description>&lt;H1 style="MARGIN: 12pt 0in 3pt; TEXT-ALIGN: center" align=center&gt;&lt;FONT size=5&gt;&lt;FONT face=Arial&gt;CORBA Programming with TAO - 4.Basic Functions&lt;/FONT&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"&gt;（常用基本方法解析）&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/H1&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"&gt;&lt;EM&gt;摘要：&lt;/EM&gt;&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;简要介绍&lt;/SPAN&gt;CORBA&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;规范定义的几个常用基本方法的功能及应用中需要注意的问题。&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"&gt;&lt;EM&gt;正文：&lt;/EM&gt;&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;idl&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;编译器会为每个在&lt;/SPAN&gt;idl&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;中声明的&lt;/SPAN&gt;interface&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;生成一个对应的代理基类：&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;class&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt; InterfaceName;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'"&gt;以及两个对象引用类型：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt"&gt;InterfaceName_ptr&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'"&gt;和&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt"&gt;InterfaceName_var&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'"&gt;前者是一个指针类型，其定义往往是：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;typedef&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt; InterfaceName* InterfaceName;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'"&gt;因此，不作过多讨论。&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;InterfaceName_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;则是一个智能指针类，通过使用智能指针类，免去了我们手工维护指针引用计数的工作，大大简化了应用程序的编写。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;下面重点对代理基类和&lt;/SPAN&gt;_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;智能指针类中的几个基本方法进行简单说明。&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;EM&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;一、代理基类中定义的几个基本方法&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;每个代理基类（以及&lt;/SPAN&gt;CORBA::Object&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;）都提供如下几个静态方法：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 12pt 0in 3pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: Symbol"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Arial&gt;_duplicate&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'"&gt;返回一个参数指针的拷贝（为了免去对象深拷贝所引起的消耗，实际是通过调整引用计数的方法实现的）&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 12pt 0in 3pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: Symbol"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Arial&gt;_nil&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'"&gt;返回相应接口类型的空引用&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 12pt 0in 3pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: Symbol"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Arial&gt;_narrow&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'"&gt;尝试将参数指针转型为目标指针，若转换失败，则返回目标类型的空引用。&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'"&gt;除了以上静态方法，每个代理类还包括两个方法：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 12pt 0in 3pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: Symbol"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Arial&gt;_is_a&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;该方法接收一个类型&lt;/SPAN&gt;id&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;信息&lt;/SPAN&gt;const char *type_id&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;，并返回一个&lt;/SPAN&gt;CORBA::Boolean&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;，用于判断某个引用是否是&lt;/SPAN&gt;type_id&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;所指示的类型。&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 12pt 0in 3pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: Symbol"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Arial&gt;_this&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'"&gt;该方法返回当前对象的拷贝的引用。&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 12pt 0in 3pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: Symbol"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Arial&gt;_add_ref/_remove_ref&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;用于增加引用计数和减小引用计数，在我们编写接口实现时可能会用到（客户程序中无法使用这两个方法，因为只有&lt;/SPAN&gt;Skeleton&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;代码中会生成这两个方法，客户程序代码也没有必要使用这两个方法来维护引用计数）。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;此外，在&lt;/SPAN&gt;CORBA&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;命名空间中还定义了：&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 12pt 0in 3pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: Symbol"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Arial&gt;CORBA::is_nil&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;判断某个&lt;/SPAN&gt;ptr&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;是否为空&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 12pt 0in 3pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: Symbol"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Arial&gt;CORBA::release&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;释放参数对象。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;而为了比较两个引用是否相同，&lt;/SPAN&gt;CORBA::Object&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;中定义了方法：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 12pt 0in 3pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: Symbol"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Arial&gt;is_equivalent&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;按照&lt;/SPAN&gt;CORBA&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;规范，不使用以上基本方法对&lt;/SPAN&gt;CORBA&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;对象或对象指针进行比较、类型转换、非空测试等所产生的行为都是未定义的。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;这几个方法本身比较简单，并且后续的文章中将看到上述各基本方法的使用，这里就先不举例了。&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;EM&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"&gt;二、&lt;/SPAN&gt;&lt;FONT face=Arial&gt;_var&lt;/FONT&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"&gt;智能指针类中的基本方法&lt;/SPAN&gt;&lt;/EM&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;按照&lt;/SPAN&gt;CORBA&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;规范，每个&lt;/SPAN&gt;_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;智能指针类都包括如下几个方法：&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo1; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: 'Courier New'"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;in&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo1; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: 'Courier New'"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;out&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo1; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: 'Courier New'"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;inout&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo1; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: 'Courier New'"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;_retn&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo1; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: 'Courier New'"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;ptr&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;掌握这几个方法的最简单的方法是学习&lt;/SPAN&gt;CORBA::String_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;类的实现。&lt;/SPAN&gt;CORBA::String_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;是&lt;/SPAN&gt;CORBA::String&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;类的智能指针类，其中封装了一个&lt;/SPAN&gt;char*&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;指针。我们来看看&lt;/SPAN&gt;TAO&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;是如何实现这几个方法的（见&lt;/SPAN&gt;%TAO_ROOT%/tao/CORBA_String.inl&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;）&lt;/SPAN&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'"&gt;：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;ACE_INLINE &lt;SPAN style="COLOR: blue"&gt;const&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;char&lt;/SPAN&gt; *&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;CORBA::String_var::in (&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt;) &lt;SPAN style="COLOR: blue"&gt;const&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;-&amp;gt;ptr_;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;ACE_INLINE &lt;SPAN style="COLOR: blue"&gt;char&lt;/SPAN&gt; *&amp;amp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;CORBA::String_var::inout (&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;-&amp;gt;ptr_;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;ACE_INLINE &lt;SPAN style="COLOR: blue"&gt;char&lt;/SPAN&gt; *&amp;amp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;CORBA::String_var::out (&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;CORBA::string_free (&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;-&amp;gt;ptr_);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;-&amp;gt;ptr_ = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;-&amp;gt;ptr_;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;ACE_INLINE &lt;SPAN style="COLOR: blue"&gt;char&lt;/SPAN&gt; *&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;CORBA::String_var::_retn (&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;char&lt;/SPAN&gt; *temp = &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;-&amp;gt;ptr_;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;-&amp;gt;ptr_ = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; temp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;/// TAO extension.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;ACE_INLINE &lt;SPAN style="COLOR: blue"&gt;char&lt;/SPAN&gt; *&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;CORBA::String_var::ptr (&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;-&amp;gt;ptr_;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;表面看来似乎没有什么值得注意的，只是返回了几个不同类型的指针：&lt;/SPAN&gt;in&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;方法返回一个指针（因仅作为传入参数），&lt;/SPAN&gt;inout&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;方法返回一个指针的引用（因不仅要作我传入参数，还要通过函数调用修改其内容），&lt;/SPAN&gt;out&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;方法同样返回一个指针的引用（因需要通过函数调用修改其内容），&lt;/SPAN&gt;inout&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;方法返回一个指针（因仅作为返回参数，不能修改），&lt;/SPAN&gt;ptr&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;也返回一个普通指针，同样也不能修改内容。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;但仔细看一看&lt;/SPAN&gt;_retn&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;的实现，你会发现，该方法首先保存了指针的内容，然后将指针清&lt;/SPAN&gt;0&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;（这样当&lt;/SPAN&gt;String_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;被释放时就不会&lt;/SPAN&gt;free&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;原来的地址空间），最后将该指针返回。也就是说，通过该方法调用，&lt;/SPAN&gt;String_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;对象所指向的地址空间的控制权被交给了调用该方法的一方，同样，释放地址空间的工作也应该由调用该方法的一方来完成。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;而对于&lt;/SPAN&gt;out&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;方法，为了保证原指针被安全释放，该方法先释放原来指向的地址空间，并将指针清&lt;/SPAN&gt;0&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;，最后返回该指针的引用。因此，被调用的方法内部应负责为该对象分配空间，而释放该空间的工作则是由调用方完成的。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;其他对象上述方法的实现与&lt;/SPAN&gt;String_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;在原理上是基本一致的，只是&lt;/SPAN&gt;IDL&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;编译器&lt;/SPAN&gt;tao_idl&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;在生成&lt;/SPAN&gt;stub&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;和&lt;/SPAN&gt;skeleton&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;代码时会分别为定长结构体和变长结构体应用不同的类模板，从而生成不同类型的&lt;/SPAN&gt;_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;类。对于定长结构体，应用的类模板为&lt;/SPAN&gt;TAO_Fixed_Var_T&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;，而对于变长结构体，应用的类模板为&lt;/SPAN&gt;TAO_Var_Var_T&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;。二者的区别在于对于定长结构体而言，&lt;/SPAN&gt;_retn&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;和&lt;/SPAN&gt;out&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;方法与&lt;/SPAN&gt;inout&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;方法的实现是一样的，没有清&lt;/SPAN&gt;0&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;的过程，以下是&lt;/SPAN&gt;TAO_Fixed_Var_T&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;模板类中的相关代码：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;// Mapping for fixed size.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;template&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;typename&lt;/SPAN&gt; T&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;ACE_INLINE &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;T &amp;amp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;TAO_Fixed_Var_T&amp;lt;T&amp;gt;::out (&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; *&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;-&amp;gt;ptr_;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;template&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;typename&lt;/SPAN&gt; T&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;ACE_INLINE &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;T&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;TAO_Fixed_Var_T&amp;lt;T&amp;gt;::_retn (&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; *&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;-&amp;gt;ptr_;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;关于&lt;/SPAN&gt;_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;类的更多信息，可参考&lt;/SPAN&gt;%TAO_ROOT%/tao/VarOut_T.inl&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;，或：&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A href="http://www.dre.vanderbilt.edu/Doxygen/Current/html/tao/classTAO__Var__Var__T.html"&gt;http://www.dre.vanderbilt.edu/Doxygen/Current/html/tao/classTAO__Var__Var__T.html&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A href="http://www.dre.vanderbilt.edu/Doxygen/Current/html/tao/classTAO__Fixed__Var__T.html"&gt;http://www.dre.vanderbilt.edu/Doxygen/Current/html/tao/classTAO__Fixed__Var__T.html&lt;/A&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"&gt;&lt;EM&gt;三、典型问题解析&lt;/EM&gt;&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;上面简单介绍了&lt;/SPAN&gt;CORBA&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;编程中常用的几个基本方法，下面在此基础上对内存管理相关的几个问题进行简要分析。&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 12pt 0in 3pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo5; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: Symbol; mso-bidi-font-family: 'Times New Roman'"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;包含变长成员变量的结构体的内存释放问题&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;以下面的&lt;/SPAN&gt;idl&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;为例：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;struct&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt; DemoStruct {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;string name_;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'"&gt;对于如下的代码：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt; main() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;//...&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DemoStruct_var demo = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; DemoStruct;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;demo.name_ = CORBA::string_dup(&lt;SPAN style="COLOR: maroon"&gt;"Hello"&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;//...&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;由于我们使用了&lt;/SPAN&gt;_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;智能指针类，通过&lt;/SPAN&gt;new&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;动态分配的空间会在&lt;/SPAN&gt;demo&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;对象被销毁时被释放，但是其中通过&lt;/SPAN&gt;CORBA::string_dup&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;为成员变量&lt;/SPAN&gt;name_&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;所分配的空间是否会泄漏呢？&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;答案是：不会。这是因为&lt;/SPAN&gt;idl&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;文件中结构体的&lt;/SPAN&gt;string&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;成员变量经过&lt;/SPAN&gt;tao_idl&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;编译后，被映射为&lt;/SPAN&gt;TAO_String_Manager&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;，这种类型与&lt;/SPAN&gt;String_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;基本是一样的，只是&lt;/SPAN&gt;String_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;不带任何参数的构造函数会将指针&lt;/SPAN&gt;ptr_&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;初始化为&lt;/SPAN&gt;0&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;，而&lt;/SPAN&gt;TAO_String_Manager&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;不带任何参数的构造函数则会将&lt;/SPAN&gt;ptr_&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;初始化成一个空字符串，具体可见&lt;/SPAN&gt;%TAO_ROOT%/tao/Managed_Types.i&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;及&lt;/SPAN&gt;%TAO_ROOT%/tao/CORBA_String.inl&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;因此，当结构体被释放时，我们就无需为其中的&lt;/SPAN&gt;string&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;的释放问题担心。对于其它包含变长类型的结构体而言，情况是一样的。&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 12pt 0in 3pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo5; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: Symbol"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Arial&gt;_var&lt;/FONT&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"&gt;类使用的误区&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;在使用&lt;/SPAN&gt;String_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;时有一个问题需要注意，&lt;/SPAN&gt;String_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;提供了三个构造函数（见&lt;/SPAN&gt;%TAO_ROOT%/tao/CORBA_String.h&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;）&lt;/SPAN&gt;:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;CORBA::String_var::String_var (&lt;SPAN style="COLOR: blue"&gt;char&lt;/SPAN&gt; *p)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;: ptr_ (p)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;ACE_INLINE&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;CORBA::String_var::String_var (&lt;SPAN style="COLOR: blue"&gt;const&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;char&lt;/SPAN&gt; *p)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;: ptr_ (CORBA::string_dup (p))&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;CORBA::String_var::String_var (&lt;SPAN style="COLOR: blue"&gt;const&lt;/SPAN&gt; CORBA::String_var&amp;amp; r)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;-&amp;gt;ptr_ = CORBA::string_dup (r.ptr_);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;}&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;第一个构造函数仅对指针&lt;/SPAN&gt;p&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;进行浅拷贝，保存到内部的&lt;/SPAN&gt;ptr_&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;中，而后面两个则通过深拷贝来构造&lt;/SPAN&gt;String_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;对象。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;两种不同的构造方式区别虽然比较小，但可能引起一些十分隐蔽的问题。如下面的代码就存在问题：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;String_var str(&lt;SPAN style="COLOR: maroon"&gt;"Hello"&lt;/SPAN&gt;);&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;因为上述代码会使用第一个而不是第二个构造函数来构造&lt;/SPAN&gt;str&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;，从而使得&lt;/SPAN&gt;str&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;获得静态地址空间&lt;/SPAN&gt;"Hello"&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;的控制权，并在&lt;/SPAN&gt;str&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;被析构时尝试释放该空间，这显然是错误的。要避免该错误，我们应该总是强制使用第二个构造函数，或在构造&lt;/SPAN&gt;Stirng_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;对象前主动复制&lt;/SPAN&gt;String&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;的内容，如：&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;String_var str1((&lt;SPAN style="COLOR: blue"&gt;const&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;char&lt;/SPAN&gt;*)&lt;SPAN style="COLOR: maroon"&gt;"Hello"&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;String_var str2(CORBA::string_dup(&lt;SPAN style="COLOR: maroon"&gt;"Hello"&lt;/SPAN&gt;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;除非你清楚地知道第一个构造函数是你需要的。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;对于其它&lt;/SPAN&gt;_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;类型而言，不存在与上面第二种构造方式等价的构造函数，我们总是使用第一种形式的构造函数，即新构造的&lt;/SPAN&gt;_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;对象会获得指针的控制权。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;与上面第三种构造方式类似，如果你传入的是一个&lt;/SPAN&gt;_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;引用，则使用的是如下的构造函数：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;template&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;typename&lt;/SPAN&gt; T&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;TAO_Var_Base_T&amp;lt;T&amp;gt;::TAO_Var_Base_T (&lt;SPAN style="COLOR: blue"&gt;const&lt;/SPAN&gt; TAO_Var_Base_T&amp;lt;T&amp;gt; &amp;amp; p)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;: ptr_ (p.ptr_ ? &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; T (*p.ptr_) : 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;该构造函数会对传入的&lt;/SPAN&gt;_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;引用进行深拷贝。&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 12pt 0in 3pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo5; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: Symbol; mso-bidi-font-family: 'Times New Roman'"&gt;&amp;#183;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;对远程方法调用内存管理问题的解释&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;CORBA&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;内存分配&lt;/SPAN&gt;/&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;释放的原则很简单：各自负责自己分配空间的释放，&lt;/SPAN&gt;C/S&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;两端内存的分配与释放（以及更新）不会自动通知另一方。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;对于&lt;/SPAN&gt;Client&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;代码而言，由&lt;/SPAN&gt;Client&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;代码负责释放的空间还包括&lt;/SPAN&gt;ORB&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;在&lt;/SPAN&gt;unmarshalling&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;期间创建的&lt;/SPAN&gt;Server&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;的指针的镜像，即&lt;/SPAN&gt;Server&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;端指针的本地拷贝，这些空间可能是&lt;/SPAN&gt;out/inout&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;参数或者作为接口方法的返回值通过方法调用获得的。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;这在理解上应该没有什么问题。但是，其中对于&lt;/SPAN&gt;Server&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;方的内存管理，我们没有考虑。以如下代码为例：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;DemoStruct* DemoIntf::foo() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DemoStruct_var var = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; DemoStruct;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;//...&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; var._retn();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;当函数返回时，&lt;/SPAN&gt;Client&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;方&lt;/SPAN&gt;ORB&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;会通过&lt;/SPAN&gt;unmarshalling&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;创建一个该指针所指内存区域的镜像，然后访问该指针，最后由&lt;/SPAN&gt;Client&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;方负责该区域的释放；但是我们说过，&lt;/SPAN&gt;C/S&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;双方分配和释放内存并不会自动通知另一方，对于&lt;/SPAN&gt;Server&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;方而言，由于&lt;/SPAN&gt;_retn&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;方法会释放原&lt;/SPAN&gt;_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;对象对其&lt;/SPAN&gt;ptr_&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;指针所指地址空间的控制权，原来由&lt;/SPAN&gt;_var&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;对象所管理的空间似乎变得失去了控制，那么这一部分内存是否会泄漏呢？&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;同样，答案是不会，这是因为&lt;/SPAN&gt;ORB&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;在将该指针进行&lt;/SPAN&gt;marshalling&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;并传递给&lt;/SPAN&gt;Client&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;后，会负责指针所指空间的释放，同样对于&lt;/SPAN&gt;in&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;、&lt;/SPAN&gt;out&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;、&lt;/SPAN&gt;inout&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;参数的管理也是类似的。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;结合上面对&lt;/SPAN&gt;Server&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;方内存管理方式的讨论，我们来看看下面的例子。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;对于如下的&lt;/SPAN&gt;idl&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;文件：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;struct&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt; DemoStruct {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;string name_;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;interface&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt; DemoIntf {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DemoStruct get();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'"&gt;有类似下面的实现：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;class&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt; DemoIntf : ...&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DemoStruct_var demo_;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DemoStruct* get() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; demo_;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;上述实现初看起来可以正常工作，但是根据上面的讨论，&lt;/SPAN&gt;ORB&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;会释放返回值指针的地址空间，这将导致&lt;/SPAN&gt;demo_&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"&gt;被意外释放，最终导致错误的发生。因此，我们应该将实现代码改为：&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;DemoStruct* get() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;::Device::DeviceID_var dev_id = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; ::Device::DeviceID;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;dev_id-&amp;gt;device_name = CORBA::string_dup(id_-&amp;gt;device_name);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; dev_id._retn();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'"&gt;而客户方代码的代码是这样的：&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US"&gt;::Device::DeviceID_var device_id = &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;-&amp;gt;device_id();&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;SPAN lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"&gt;&lt;EM&gt;参考：&lt;/EM&gt;&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .25in"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Michi Henning, Steve Vinoski. Advanced CORBA Programming with C++. Addison-Wesley, 1999.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .25in"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Douglas C. Schmidt &amp;amp; Bala Natarajan. CORBA Tutorial. &lt;A href="http://www.cs.wustl.edu/~schmidt/PDF/corba4.pdf"&gt;http://www.cs.wustl.edu/~schmidt/PDF/corba4.pdf&lt;/A&gt;&lt;/P&gt;&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/20032.html" width = "1" height = "1" /&gt;</description></item><item><dc:creator>大卫的思维空间</dc:creator><title>CORBA Programming with TAO - 3.IDL Data Type（数据类型与Mapping）</title><link>http://blog.vckbase.com/billdavid/archive/2006/05/12/20027.html</link><pubDate>Fri, 12 May 2006 07:57:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2006/05/12/20027.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/20027.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2006/05/12/20027.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/20027.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/20027.html</trackback:ping><description>简要介绍TAO支持的IDL数据类型及其C++ Mapping关系。&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/20027.html" width = "1" height = "1" /&gt;</description></item><item><dc:creator>大卫的思维空间</dc:creator><title>CORBA Programming with TAO - 2.Compile Source Code（编译ACE/TAO/CIAO）</title><link>http://blog.vckbase.com/billdavid/archive/2006/05/12/20026.html</link><pubDate>Fri, 12 May 2006 07:42:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2006/05/12/20026.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/20026.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2006/05/12/20026.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/20026.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/20026.html</trackback:ping><description>简要介绍如何在Windows平台上编译ACE/TAO/CIAO，及编译过程中需注意的问题。&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/20026.html" width = "1" height = "1" /&gt;</description></item><item><dc:creator>大卫的思维空间</dc:creator><title>CORBA Programming with TAO - 1.Start（基本概念）</title><link>http://blog.vckbase.com/billdavid/archive/2006/05/12/20025.html</link><pubDate>Fri, 12 May 2006 07:38:00 GMT</pubDate><guid>http://blog.vckbase.com/billdavid/archive/2006/05/12/20025.html</guid><wfw:comment>http://blog.vckbase.com/billdavid/comments/20025.html</wfw:comment><comments>http://blog.vckbase.com/billdavid/archive/2006/05/12/20025.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://blog.vckbase.com/billdavid/comments/commentRss/20025.html</wfw:commentRss><trackback:ping>http://blog.vckbase.com/billdavid/services/trackbacks/20025.html</trackback:ping><description>简要介绍CORBA的基本原理，并解释POA、stub、skeleton、servant等重要概念。&lt;img src ="http://blog.vckbase.com/billdavid/aggbug/20025.html" width = "1" height = "1" /&gt;</description></item></channel></rss>