Re: C++ mapping of OUT variable-length structures
- From: ERDI Gergo <cactus cactus rulez org>
- To: Diego Sevilla Ruiz <dsevilla ditec um es>
- Cc: ORBit/C++ <orbitcpp-list lists sourceforge net>,orbit-list gnome org
- Subject: Re: C++ mapping of OUT variable-length structures
- Date: Wed, 24 Apr 2002 21:31:55 +0200 (CEST)
On Wed, 24 Apr 2002, Diego Sevilla Ruiz wrote:
> | So this is useful when you pass in (on the caller side) a non-empty
> | structure, right?
>
> Hmmm... I can't understand what you mean by a non-empty structure...
> This has nothing to do with either if the structure is empty or
> non-empty... (and I don't see the need for an empty structure either...)
OK so let's talk about actual code here.
Suppose I have the following on the client side:
Test::Test_st *strct;
master_ptr->foo (strct);
// Do stuff on strct
delete strct;
The signature of foo is, according to this _out convention:
void foo (Test::Test_st_out struct_out);
So in the above example, when master_ptr->foo returns, struct_out points
to a valid structure, right?
So, what happens when instead, the following is done:
Test::Test_st *strct = new Test::Test_st;
// Fill strct
// Use it as an IN parameter
other_ptr->other_method (*strct);
master_ptr->foo (strct);
delete strct;
Will master_ptr->foo in this case delete the old strct first? Or is this
simply something that shouldn't be done? If it shouldn't be done, then I,
again, don't understand what the _out class is supposed to do: you could
use vanilla Test::Test_st*&'s as the OUT argument type and do the same.
--
.--= ULLA! =---------------------. `We are not here to give users what
\ http://cactus.rulez.org \ they want' -- RMS, at GUADEC 2001
`---= cactus@cactus.rulez.org =---'
find / -user `grep ^you: /etc/passwd|cut -d: -f3` -a -name base -exec chown us.us {} \;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]