[omniORB] "Segmentation Fault" Error while handling client's requests..
Duncan Grisby
dgrisby@uk.research.att.com
Wed, 16 Jan 2002 14:32:03 +0000
On Wednesday 16 January, Slava Garelin wrote:
> On Wednesday 16 January 2002 09:21, you wrote:
> > CORBA::String_var src = "Hello! i am gamma.....";
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^
> CORBA::String_var src =CORBA::string_dup("Hello! i am gamma.....");
That's an interesting point. With a modern C++ compiler, the two lines
of code are equivalent, since string literals are const char* in
standard C++. Older C++ compilers treat string literals as char*,
though, and directly initialising a String_var with them would cause a
problem.
However, in the original problem, it was the server that crashed, not
the client that used the String_var code. Also, any potential problem
would only occur when the String_var goes out of scope and it tries to
free the string. That never happens in the example.
Cheers,
Duncan.
--
-- Duncan Grisby \ Research Engineer --
-- AT&T Laboratories Cambridge --
-- http://www.uk.research.att.com/~dpg1 --