Lady Ada Mediates Peace Treaty in Endianness War

  • Thomas Quinot
  • Eric Botcazou
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7896)


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.


endianness retargeting code generation 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Ada Rapporteur Group: Controlling bit ordering. Ada Issue AI95-00133, ISO/IEC JTC1/SC22/WG9 (2004),, adopted amendment to the Ada 95 standard [5]
  2. 2.
    Andress, R.P.: Wholesale byte reversal of the outermost Ada record object to achieve endian independence for communicated data types. Ada Letters XXV(3), 19–27 (2005)CrossRefGoogle Scholar
  3. 3.
    Cohen, D.: On Holy Wars and a Plea for Peace. IEEE Computer 14(10), 48–54 (1981)CrossRefGoogle Scholar
  4. 4.
    Cohen, N.H.: Endian-independent record representation clauses. Ada Letters XIV(1), 27–29 (1994)CrossRefGoogle Scholar
  5. 5.
    ISO: Information Technology – Programming Languages – Ada. ISO (February 1995), ISO/IEC/ANSI 8652:1995Google Scholar
  6. 6.
    ITU-T: Information technology — Abstract Syntax Notation One (ASN.1): Specification of basic notation. Recommendation X.680 (November 2008)Google Scholar
  7. 7.
    ITU-T: Information technology — ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER). Recommendation X.690 (November 2008)Google Scholar
  8. 8.
    Mardis, M.: Endian-safe record representation clauses for Ada programs. Ada Letters XIX(4), 13–18 (1999)CrossRefGoogle Scholar
  9. 9.
    Protomatics: Transfer Syntax Notation One (TSN.1). Tech. rep.,
  10. 10.
    Swift, J.: Travels into Several Remote Nations of the World. By Lemuel Gulliver (1726)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Thomas Quinot
    • 1
  • Eric Botcazou
    • 1
  1. 1.AdaCoreParisFrance

Personalised recommendations