Hacker News new | ask | show | jobs
by tjalfi 3367 days ago
TL;DR. XDR was designed in the 1980s. This is a major factor in Decisions 2 and 3.

RFC1832 has a rationale for decision 2 towards the end of the document. Here is an excerpt.

   "(4) Why is the XDR unit four bytes wide?
      There is a tradeoff in choosing the XDR unit size.  Choosing a small
   size such as two makes the encoded data small, but causes alignment
   problems for machines that aren't aligned on these boundaries.  A
   large size such as eight means the data will be aligned on virtually
   every machine, but causes the encoded data to grow too big.  We chose
   four as a compromise.  Four is big enough to support most
   architectures efficiently, except for rare machines such as the
   eight-byte aligned Cray*.  Four is also small enough to keep the
   encoded data restricted to a reasonable size."
Most RISC architectures of the time did not support unaligned memory accesses.

Decision 3 is a matter of timing. RFC1014 ( https://tools.ietf.org/html/rfc1014) was released in 1987. Unicode was still a work in progress.

Edited to fix formatting of the excerpt and a typo.

1 comments

Thanks for pointing these out! This sort of archaeology is always interesting. I tend to have to do it for Protocol Buffers too to understand various design decisions.