[omniORB] basic question about sequences
Michael
omniorb at bindone.de
Tue Aug 5 17:13:48 BST 2008
Since we're using auto_ptr, boost::shared_ptr etc. a lot everywhere, I
personally prefer it the other way round :)
(actually I use a lot of STL constructs and have a little template
library for converting everything on return).
Anyway, you're right about initializing the out parameter, there
should've been be a line
seq_out = new seq_type;
in my example (but seq_out will never be NULL (but nil :)).
I just grepped through my codebase, and it appears I used out parameters
twice in 5 years :) I generally prefer returning structs/sequences
whatever, because out parameters make me feel ... bad inside :)
cheers
michael
Clarke Brunt wrote:
>> ...
>> (of course this works without auto_ptr, but it's a good habbit to
>> prevent memory leaks - you could also use _var and then release it, put
>> personally I prefer auto_ptr)
>
> Just to be awkward, I take the opposite view and use _var (well we _are_
> using CORBA anyway) :-)
>
> So if you want to take the _var route, then
> seq_type_var ret = new seq_type; // as first line of implementation
> ret[i] = whatever; // don't want a '*' here
> return ret._retn(); // as last line
> // other lines the same
>
> And, without taking the time to remind myself of all the detail of this,
> isn't it necessary also to create a new sequence for the 'out' parameter? I
> would have thought it likely to contain a NULL otherwise.
>
>
>
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
More information about the omniORB-list
mailing list