[omniORB] Deletect failed allocation to a _var
EXT-Pennington, Dale K
dale.k.pennington at boeing.com
Thu Jun 5 09:37:40 BST 2008
I recalled the same thing on CORBA::is_nil(), but your option at least
passed the compiler test.
Thanks
> -----Original Message-----
> From: Clarke Brunt [mailto:clarke.brunt at trafficmaster.co.uk]
> Sent: Thursday, June 05, 2008 7:22 AM
> To: omniorb-list at omniorb-support.com
> Subject: RE: [omniORB] Deletect failed allocation to a _var
>
> >At one point of the code, they are performing as assert
> check to make
> >sure that a new operation succeeded. The code :
> >
> >CosNaming::Name_var compound_name = new CosNaming::Name(count);
> >assert(compound_var != 0); ...
> >So the question. How would I check to confirm that the new worked
> >successfully. I guess maybe something with operator ->, but
> I am not
> >experienced enough in that part of C++ to see how.
>
> As someone has already said, if 'new' itself throws an
> exception, then maybe this isn't relevant. But I've wanted to
> check in programs whether or not a var has been 'filled in' or not.
>
> I half-recall the spec. saying that one mustn't 'use' vars
> before allocating something to them, but anyway, the way with
> operator-> is simply:
>
> assert(compound_var.operator->() != 0)
>
> I don't think CORBA::is_nil() is any good - isn't that only
> for object references?
>
> --
> Clarke Brunt
>
>
> _______________________________________________
> 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