Lady Ada Mediates Peace Treaty in Endianness War

There is no universal agreement on the order in which the successive bytes constituting a scalar value are stored. Some machines (so-called big-endian architectures) store the most significant byte first, while others (little-endian architectures) adopt the opposite convention. When porting an application across platforms that use different conventions, programmers need to convert data to the appropriate convention, and this may cause difficulties when exact memory layouts need to be preserved (e.g. for communication with legacy systems).

This paper describes the features of the Ada language that help supporting programmers in these situations, identifies some of their shortcomings, and introduces two novel solutions: a code generation approach based on data representation modeling, and a new representation attribute Scalar Storage Order , allowing the byte order convention to be specified for a given composite data structure.

This is a pre-copyedited version of a contribution that appeared in the proceedings of the Ada-Europe 2013 Reliable Software Technologies conference, published by Springer Verlag. The definitive authenticated version is available online via