Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CORBA IDL to C++ - char vs. unsigned char?

Tags:

c++

corba

omniorb

We're using OmniORB with our C++ server. Currently, when an object is specified as a char in the IDL file, it is translated to an unsigned char in C++. We want it to be just char. Is there something we can change to make this happen?

like image 247
Jesse Jashinsky Avatar asked Nov 29 '25 21:11

Jesse Jashinsky


2 Answers

It is implementation defined (page 15 in the spec) what the IDL types boolean, char and octet map to.

omniORB chooses to:

...
typedef unsigned char _CORBA_Char;
typedef unsigned char _CORBA_Octet; 
...

You can change the omniORB sources, though I doubt that would be a good idea. Or you can accept that CORBA::Char does not represent the C++ char type.

like image 123
Martin Ba Avatar answered Dec 02 '25 09:12

Martin Ba


I would recommend using CORBA::Char when calling functions that are direct CORBA calls and assigning return values of such functions.

If you need to convert them to/from 'char' or 'unsigned char', a static_cast should do the job.

like image 25
R Sahu Avatar answered Dec 02 '25 11:12

R Sahu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!