Problem

What is the C++ size in the mapping for CORBA types?

Solution

A: The C++ size depends on the architecture and is not fixed in the specifications.

For example the CORBA type ULongLong does not fit into a C++ unsigned long on 32 bit systems.
Here it is mapped to unsigned long long which is 8 bystes in size as CORBA::ULongLong is. On 64-bit systems, it is mapped to unsigned long because long is a 64-bit type there and not == int, which is a 32-bit type there.

The attached size_of.cpp small program prints the size of every relevant C++ and CORBA type size.

Compile it using this command line:

     g++ -I$ACE_ROOT -I$ACE_ROOT/TAO -o size_of size_of.cpp 

and attach the output here below if it is for an architecture not already listed.


Linux RH-E 4 on INTEL PC 32 bits


     sizeof(bool)=1
     sizeof(char)=1
     sizeof(short)=2
     sizeof(int)=4
     sizeof(long)=4
     sizeof(long long)=8
     sizeof(unsigned char)=1
     sizeof(unsigned short)=2
     sizeof(unsigned int)=4
     sizeof(unsigned long)=4
     sizeof(unsigned long long)=8
     sizeof(float)=4
     sizeof(double)=8
     sizeof(long double)=12
     sizeof(CORBA::Boolean)=1
     sizeof(CORBA::Octet)=1
     sizeof(CORBA::Char)=1
     sizeof(CORBA::WChar)=4
     sizeof(CORBA::Short)=2
     sizeof(CORBA::UShort)=2
     sizeof(CORBA::Long)=4
     sizeof(CORBA::ULong)=4
     sizeof(CORBA::LongLong)=8
     sizeof(CORBA::ULongLong)=8
     sizeof(CORBA::Float)=4
     sizeof(CORBA::Double)=8
     sizeof(CORBA::LongDouble)=16


Scientific Linux SL release 4.1 (Beryllium) on octuple AMD Opteron(tm) Processor 875 (8 dual core CPUs)

Added for AIRUB, by courtesy of RolandLemke. -- ThomasJuerges - 10 Apr 2006


     sizeof(bool)=1
     sizeof(char)=1
     sizeof(short)=2
     sizeof(int)=4
     sizeof(long)=8
     sizeof(long long)=8
     sizeof(unsigned char)=1
     sizeof(unsigned short)=2
     sizeof(unsigned int)=4
     sizeof(unsigned long)=8
     sizeof(unsigned long long)=8
     sizeof(float)=4
     sizeof(double)=8
     sizeof(long double)=16
     sizeof(CORBA::Boolean)=1
     sizeof(CORBA::Octet)=1
     sizeof(CORBA::Char)=1
     sizeof(CORBA::WChar)=4
     sizeof(CORBA::Short)=2
     sizeof(CORBA::UShort)=2
     sizeof(CORBA::Long)=4
     sizeof(CORBA::ULong)=4
     sizeof(CORBA::LongLong)=8
     sizeof(CORBA::ULongLong)=8
     sizeof(CORBA::Float)=4
     sizeof(CORBA::Double)=8
     sizeof(CORBA::LongDouble)=16

-- GianlucaChiozzi - 31 Mar 2006

  • size_of.cpp: Little utility to print the size of CORBA types in CPP mapping

Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.



Related issues