Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[tao-users] C++ mapping of CORBA::ULong

25 views
Skip to first unread message

Bartsch Steffen

unread,
Sep 17, 2002, 4:12:52 AM9/17/02
to

Hi all,

I've got a question concering C++ mapping of CORBA::ULong in TAO:
Why the CORBA::ULong on Windows is mapped to unsigned int and not to unsigned long?

I found the foloowing definitions of CORBA::ULong --> ACE_CDR::ULong --> ACE_UINT32:


in tao/corbafwd.h:
------------------------
typedef ACE_CDR::ULong  ULong;


in ace/CDR_Base.h:     
----------------------------
typedef ACE_UINT32      ULong;


in ace/Basic_Types.h:
--------------------------------
# if ACE_SIZEOF_INT == 4
   ...
   typedef unsigned int ACE_UINT32
   ....
# elif ACE_SIZEOF_LONG == 4
   ...
   typedef unsigned long ACE_UINT32
   ...
# endif

On my system ACE_SIZEOF_LONG == 4, but unfortunately also ACE_SIZEOF_INT == 4.
My question is: Why is this mapping done in this way?

We'r migrating our software from Visibroker 4  to TAO and that type definition causes some problems.
Can I change the definition in a safe way?




Douglas C. Schmidt

unread,
Sep 17, 2002, 12:53:17 PM9/17/02
to
Hi Bartsch,

To ensure that we have proper version/platform/compiler information,
please make sure you fill out the appropriate problem report form
(PRF), which is in

$ACE_ROOT/PROBLEM-REPORT-FORM
$TAO_ROOT/PROBLEM-REPORT-FORM

or in

$ACE_ROOT/BUG-REPORT-FORM
$TAO_ROOT/BUG-REPORT-FORM

in older versions of ACE+TAO. Make sure to include this information
when asking any questions about ACE+TAO since otherwise we have to
"guess" what version/platform/compiler/options you've using, which is
error-prone and slows down our responsiveness.

Thanks,

Doug

>> I've got a question concering C++ mapping of CORBA::ULong in TAO:
>> Why the CORBA::ULong on Windows is mapped to unsigned int and not to
>> unsigned long?
>>

>> I found the foloowing definitions of CORBA::ULong --> ACE_CDR::ULong --> =


>> ACE_UINT32:
>>
>>
>> in tao/corbafwd.h:
>> ------------------------
>> typedef ACE_CDR::ULong ULong;
>>
>>

>> in ace/CDR_Base.h:=09


>> ----------------------------
>> typedef ACE_UINT32 ULong;
>>
>>
>> in ace/Basic_Types.h:
>> --------------------------------

>> # if ACE_SIZEOF_INT =3D=3D 4


>> ...
>> typedef unsigned int ACE_UINT32
>> ....

>> # elif ACE_SIZEOF_LONG =3D=3D 4


>> ...
>> typedef unsigned long ACE_UINT32
>> ...
>> # endif
>>

>> On my system ACE_SIZEOF_LONG =3D=3D 4, but unfortunately also =
>> ACE_SIZEOF_INT =3D=3D 4.


>> My question is: Why is this mapping done in this way?
>>

>> We'r migrating our software from Visibroker 4 to TAO and that type =


>> definition causes some problems.
>> Can I change the definition in a safe way?


--
Dr. Douglas C. Schmidt, Associate Professor TEL: (949) 824-1901
Dept of Electrical & Computer Engineering FAX: (949) 824-2321
616E Engineering Tower WEB: www.ece.uci.edu/~schmidt/
University of California, Irvine, 92697-2625 NET: sch...@uci.edu

Ossama Othman

unread,
Sep 17, 2002, 7:42:34 PM9/17/02
to
Hi,

On Tue, Sep 17, 2002 at 10:07:21AM +0200, Bartsch Steffen wrote:
> I've got a question concering C++ mapping of CORBA::ULong in TAO:
> Why the CORBA::ULong on Windows is mapped to unsigned int and not to
> unsigned long?

The CORBA specification only requires that CORBA::ULong be mapped to a
32 bit unsigned integer value. If "unsigned int" is 32 bits, it is
perfectly valid to map CORBA::ULong to it.

> I found the foloowing definitions of CORBA::ULong --> ACE_CDR::ULong
> --> ACE_UINT32:

[snip]


> On my system ACE_SIZEOF_LONG == 4, but unfortunately also ACE_SIZEOF_INT == 4.
> My question is: Why is this mapping done in this way?

It is a valid mapping.

> We'r migrating our software from Visibroker 4 to TAO and that type
> definition causes some problems.

What kinds of problems?

> Can I change the definition in a safe way?

Since "unsigned int" is apparently a 32 bit integer on Win32
platforms, it's not clear why you need to do that. Can't you just use
the CORBA::ULong type?

-Ossama
--
Ossama Othman <oss...@ece.uci.edu>
Distributed Object Computing Laboratory, Univ. of California at Irvine
1024D/F7A394A8 - 84ED AA0B 1203 99E4 1068 70E6 5EB7 5E71 F7A3 94A8

Carlos O'Ryan

unread,
Sep 23, 2002, 2:27:54 PM9/23/02
to
Hi,

"Bartsch Steffen" <bar...@ais-dresden.de> writes:

>
> On my system ACE_SIZEOF_LONG == 4, but unfortunately also ACE_SIZEOF_INT == 4.
> My question is: Why is this mapping done in this way?

Why not?

> We'r migrating our software from Visibroker 4  to TAO and that type
> definition causes some problems.

How so?

> Can I change the definition in a safe way?

I guess you can try, maybe you will expose a bug or two in the
ORB. Nothing in TAO should depend on what the definition is, but then
again, nothing in your application should depend on the exact
definition of CORBA::ULong either, it should be enough to know that it
can hold a 32-bit integer.

--
Carlos O'Ryan (cor...@atdesk.com)
#include <std.disclaimer>
#include <cute.quote> // "Speak softly and carry a megawatt laser"
1024D/46936992 33B3 C4ED AA90 FA0F E8D1 D509 FE5E 8F79 4693 6992

Oliver Kellogg

unread,
Sep 23, 2002, 7:12:58 PM9/23/02
to
"Bartsch Steffen" wrote:

> Why the CORBA::ULong on Windows is mapped to unsigned int and not to
> unsigned long?

The type "long" is evil, avoid it as much as possible.
On 64 bit architectures, its size is 8 bytes, while on 32 bit
architectures, it is 4 bytes. A totally non-portable type.

Instead, "int" is the type to use. In fact, I challenge you
to find a machine of this day and age where ACE_SIZEOF_INT
is *not* 4 bytes.

Oliver Kellogg

0 new messages