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,再返回,岂不是被清零后返回一个空值了?