Testing a sequence var (was RE: [omniORB] Allocation of memory for sequence "vars")

Visscher, Bruce VISSCHB at RJRT.com
Tue Sep 21 19:10:42 BST 2004


> In Message <434BF06670A6784D8C9F85B6F598D48F351137 at tvmailp1.rjr.com> ,
>    "Visscher, Bruce" <VISSCHB at rjrt.com> wrote:
> 
> =>I think what got lost in the discussion is that operator 
> new throws an
> =>exception in C++ unless you use an overload declared with 
> "throw()" (which
> =>you would have to go out of your way to do).
> 
>    There could be other cases where you have a method that 
> could return
> a null pointer, though, so it wouldn't hurt to be able to 
> check for it.

Agreed.  I think the discussion took a different turn (as I've
indicated in the subject header.

I think we are in agreement that it would be nice to be able
to use "if(me.operator->())".  Even if the CORBA standard
doesn't expressly allow it (and I take it that at one time 
it actually forbade users from this?) are there any CORBA
implementations where that doesn't work?

So, instead of:

TSeq_var t;
if (afterAwhileIfIFeelLikeIt())
   t=new TSeq;
....
if (t.operator->())
....

I have to write:

TSeq_var t;
bool iGuessIdid=false;
if (afterAwhileIfIFeelLikeIt()) {
   t=new TSeq;
   iGuessIdid=true;
}
....
if (iGuessIdid)
....

If the CORBA C++ mapping won't let me use TSeq_var::operator->()
(so I can pretend it's like a typical smart (e.g. auto_ptr)
pointer) then I wish it would mandate that CORBA::is_nil(TSeq_var)
be defined.

Then maniacal implementations would have their work cut out for
them.

But I guess to be fair, it would be about as easy to always 
initialize the var from an empty sequence and use t->length() instead.

-----------------------------------------
CONFIDENTIALITY NOTE:  This e-mail message, including any  attachment(s),
contains information that may be confidential,  protected by the attorney-
client or other legal privileges, and/or  proprietary non-public
information.  If you are not an intended  recipient of this message or an
authorized assistant to an intended  recipient, please notify the sender by
replying to this message and  then delete it from your system.  Use,
dissemination, distribution,  or reproduction of this message and/or any of
its attachments (if  any) by unintended recipients is not authorized and
may be unlawful.




More information about the omniORB-list mailing list