[omniORB] Deletect failed allocation to a _var

Igor Lautar Igor.Lautar at hermes-softlab.com
Wed Jun 4 21:35:50 BST 2008


Hi,

Doesn't new throw std::bad_alloc in case it cannot allocate mem?
Of course, only if exceptions are enabled.

You could also probably use CORBA::is_nil().

Regards,
Igor

EXT-Pennington, Dale K wrote:
> I am doing a port of code from one OS/compiler/ORB to a different
> OS/compiler/ORB (destination ORB being omniORB).
> 
> 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);
> 
> My compiler has issues on the assert, saying it has not != operation.
> Looking at the Naming.hh header file I can understand this, as what is
> really needed is to check if the internal reference pointer is NULL.
> How they got this to work on their other system I do not know. It was
> either an ORB specific extension, or a compiler quirk.
> 
> 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.
> 
> Thanks,
> Dale Pennington
> 
> _______________________________________________
> 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