unsigned limited to short, long, and long long?

2 posts / 0 new
Last post
Last seen: 1 year 6 months ago
Joined: 09/06/2018
Posts: 22
unsigned limited to short, long, and long long?



We are using RTI DDS v5.3.1.

Wrt to generating code from an IDL file, why is 'unsigned' limited to use with short, long, and long long ?  I couldn't find a clear explanation of this.

I"m converting old code that does not use RTI DDS and it uses other types of unsigned, like 'unsigned char' and 'unsigned int'.




Last seen: 1 year 7 months ago
Joined: 02/20/2014
Posts: 9

I think that's just the IDL standard.  Unsigned char maps to octet and unsigned int maps to unsigned long.  Note that DDS doesn't do type ambiguity based upon architecture like you're probably used to when you see long.  IDL-specified long types are always 32-bit, and long long is always 64-bit.

The only kinda gotcha is with char, where I believe the intention is that char is actually a character and not just a signed octet.  As a result spy and the admin tools always decode it to the character itself, so depending on your use case it may be easier to just promote them up to shorts.