[omniORB] Extraction of strings from Any

Luke Tunmer luke@harlequin.co.uk
Mon, 24 May 1999 11:18:53 +0100


While stepping through the Omni code which extracts a string from an Any, I
noticed that the code allocates the memory for the string and returns that.
Having seen this I naturally inserted the returned string into a _var to
look after it, and it all worked well.

However I've just read Henning and Vinoski's book "Advanced CORBA
Programming with C++" and they explicitly say that the string returned from:

CORBA::Boolean CORBA::Any::operator>>=(char*& s) const

is managed by the Any and should not be freed by the caller. The 2.3 spec of
the C++ mapping is not very clear in this regard, so it's understandable
that confusion might reign. For complex types the spec is clear in that it
does say that the Any will look after the memory.

Are people aware of this difference, and will Omni ever change it?

Thanks in advance,
Luke Tunmer