c++type-conversioncorba

Is it possible to pass long instead of CORBA::Long etc?


I cant find the answer anywhere. The quesion is (?) simple. Lets assume I have such function:

class Sth {

private:
   long u;
public:
   void set(long u)
   {
    this.u = u;
   }

};

and I run it like this:

Sth s;
CORBA::Long val = 5;
s.set(val);

Can I do this? Will everything be ok?


Solution

  • This should be fine. According to the IBM reference, an IDL long is in range of -2^31 to 2^31-1 and at least 32 bits in size.

    It should convert natively to long in c++. The standard doesn't define a size, but defines the minimum ranges these values can hold. The CORBA::Long is a typedef of long, which may change between platforms.