Corba IDL: default value for struct members

742 views Asked by At

Is it possible to define a default value for struct members in CORBA IDL? Let's take the following struct as an example:

struct Example
{
    boolean test;
};

If I compile this IDL to C++, the variable 'test' will be uninitialized after object creation. I would like it to be always set to false until it is explicitly switched to true.

2

There are 2 answers

0
Johnny Willemsen On BEST ANSWER

The OMG IDL to C++ mapping doesn't default initialize struct members. As you mentioned the IDL to C++11 mapping does specify a default value for all types, including all basic types. At the moment you have a compiler/OS supporting C++11 you should be able to use the IDL to C++11 mapping, it doesn't require you to use C++11 in your application code.

0
Deb S On

I have used omniORB and VisiBroker for CORBA implementation. None of these idl compiler support default value structure.