Archived

This forum has been archived. Please start a new discussion on GitHub.

Unsigned Integers

In our internal data we plan to use unsigned integers extensively because they are good match for the type of data we have.

Will we run into any problems casting them to signed and then recasting back to unsigned after the signed integer has been passed via Ice across the wire. We are likely to have linux servers and windows clients.

Secondly, What sort of effort would we be looking at to enable unsigned integers in the marshalling and slice code. (Our target language is only C++).

Comments

  • No, there should be no problems with casting. Note, however, that if you intend to also use languages such as Java (which do not have unsigned types), you must make sure that the unsigned type range you are using does not exceed the signed range.

    If you want to add support for native unsigned types to Ice by yourself, you would have to modify the code generators and the marshaling code of the Ice core.

    In general, I do not recommend to use unsigned types, not only because languages such as Java don't support them, but also because they tend to lead to programming mistakes in general. For example, have a look at this paper:

    http://www.aristeia.com/Papers/C++ReportColumns/sep95.pdf
  • In addition to Scott's paper that Marc recommended, I'd also suggest having a look at John Lakos's excellent book "Large-Scale C++ Software Design" (Addison-Wesley). (This book should be mandatory reading for every C++ programmer anyway.)

    John makes a very cogent argument for why unsigned integers are useless. (Bjarne agrees that unsigned integers shouldn't be in the language -- they are there only because they were there in C.)

    Cheers,

    Michi.