[omniORB] What the difference betwen long & double
Boris Khanales
boris@imagine-sw.com
hu, 9 Jul 1998 10:21:56 -0400
> From bvisscher@mindspring.com Wed Jul 8 23:40 EDT 1998
> Date: Wed, 8 Jul 1998 23:26:13 -0400
> From: Bruce Visscher <bvisscher@mindspring.com>
> Mime-Version: 1.0
> To: Boris Khanales <boris@mailhost.imagine-sw.com>
> Cc: omniorb-list@cam-orl.co.uk
> Subject: Re: [omniORB] What the difference betwen long & double
> Content-Transfer-Encoding: 7bit
>
> Boris Khanales wrote:
> >
> > > In Message <98Jul7.121037edt.11651-1@gateway.imagine-sw.com> ,
> > > boris@imagine-sw.com (Boris Khanales) wrote:
> > >
> > > =>I have kind of complex data structure:
> > > =>
> > > =>
> > > =>
> > > =>
> > > =>foo.idl
> > > =>
> > > =>struct Foo
> > > =>{
> > > =>sequence<any> data;
> > > =>};
> > > =>
> > > =>interface Hoo
> > > =>{
> > > =>long method( in Foo f );
> > > =>}
> > > =>
> > > =>
> > > =>The client does something like this:
> > > =>
> > > =>Foo f;
> > > =>f.data.length(1);
> > > =>
> > > =>Foo f2;
> > > =>f2.data.length(1);
> > > =>
> > > =>// Attn !!!
> > > =>if I do this:
> > > =>f2.data[0] <<= 1L; Everithing OK
> > > =>
> > > =>BUT
> > > =>f2.data[0] <<= 1.1; It does not work!!!
>
> Could you define "does not work"? Compiler error?
The problem is realy bad. I can not reproduce it on stand
along small app. The problem seems to me in
any <<= double
CORBA::Any::NP_replace
MemBufferedStream &MemBufferedStream::operator= (const MemBufferedStream & m)
MemBufferedStream::copy(const MemBufferedStream &m)
memcpy(startofstream(),m.startofstream(),
(omni::ptr_arith_t)m.pd_out_mkr -
(omni::ptr_arith_t)m.startofstream());
But I'm not realy sure. At one moment I thought it's an alignment problem
and startofstream() does not return correct offset, but I still do not
understand what exactly happening. When I invoke method it throw exception
I'm on
SunOS 5.5 Generic sun4u sparc SUNW,Ultra-1
and CORBA::Double does not help.
>
> > > =>
> > > =>f.data[0] <<= f2;
> > > =>
> > > =>
> > > =>
> > > =>Any ideas?
> > > =>HELPPP!?!?!
> > > =>
> > >
> > > Try "f2.data[0] <<= CORBA::Double(1.1);". It needs either a
> > > CORBA::Double or a CORBA::Float, both of which are defined as classes
> > > in OmniORB.
>
> Actually, this is true only on the VMS platform which uses a proxy to
> convert between IEEE and native. But I agree with your solution.
Well, it does not work.
>
> > > It may be getting confused over which conversion to make,
> > > so making it explicit could fix the problem.
> > >
> > > Gary Duzan
> > > GTE Laboratories
> > >
> > >
> > >
> > Does not work. I tried sensless thingth like
> > <<= *(new double( tmpDouble))
> > and CORBA::Double
> > same result.
> >
> > What is realy surprise me that I have a case
> > when I do this
> >
> > Any a1 <<= 1L;
> > Any a2 <<= 1.1;
> >
> > f2.data[0] = a2; // exception
> >
> > f2.data[0] <<= a2; // Sends message, but on recieve side
> > f2.data[0] has _tc_any type
> >
> >
> > Any difference between long & double?
>
> CORBA::Float and CORBA::Double are proxy classes on VMS. I don't see
> why that should matter, though.
>
> > I've notice float & double are the special case.
> > There is a macro HAS_DOUBLE, but ...
>
> Since you were asking about VMS before I take it you're running this on
> VMS? All I can say is that I ran all the Any and typecode tests and had
> no problems. I tried lots of different floating point combinations
> too. I'll try and see if I can reproduce this.
>
> Bruce
If I will not solve it within next 2-3 days I'm going to try my own
Doule (as stupid as long [2]), but ...
Any ideas?
PS I realize that stand along app will be a greate help, but it works.