corba基础问题求助:关于in、out、inout、_retn

忠向 2011-09-05 04:37:38
在TAO的源码中找到这段代码(来自TAO/tao/CORBA_String.h):

/// For in parameter.
inline const character_type *in (void) const
{
return this->ptr_;
}

/// For inout parameter.
inline character_type *&inout (void)
{
return this->ptr_;
}

/// For out parameter.
inline character_type *&out (void)
{
s_traits::release (this->ptr_);
this->ptr_ = 0;
return this->ptr_;
}

/// For string of return type.
inline character_type *_retn (void)
{
character_type *temp = this->ptr_;
this->ptr_ = 0;
return temp;
}

in,inout,retn函数相对简单,我算是懂了,对out就不是很明白:this->ptr_被释放,后来又被赋值为0,再返回,岂不是被清零后返回一个空值了?

...全文
201 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

1,220

社区成员

发帖
与我相关
我的任务
社区描述
企业软件 中间件技术
社区管理员
  • 中间件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧