[omniORB] String_var and ostream operations.

Duncan Grisby dgrisby@uk.research.att.com
Tue, 29 Jan 2002 11:10:54 +0000


On Wednesday 23 January, =?iso-8859-1?Q?=D3scar?= Rafael de la Cruz =?iso-8859-1?Q?S=E1nchez?= de la Plaza wrote:

> Why do I have to cast a CORBA::String_var to print its contents:
> 
> CORBA::String_var s = CORBA::string_dup("Whatever!!!!");
> cout << static_cast<char*>(s)[1] << endl; // fine
> cout << s << endl; 			  // print address of s

omniORB doesn't have explicit iostream operators at the moment, so
it's up to your compiler whether it can figure out how to output
strings properly. Some can, but others get confused.

The reason we don't have iostream operators is that having them
creates a dependency between the omniORB libraries and a particular
iostream version. Some platforms have incompatible old-style
(iostream.h) and new-style (iostream) streams, so it would restrict
use of an omniORB build to a particular form.

omniORB 4 will have iostream operators, hopefully done in a way that
doesn't cause library dependencies.

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --