[Dwarf-Discuss] What is a byte's size?

Robinson, Paul T NonStop paul.t.robinson@hp.com
Mon Jul 21 16:12:20 GMT 2008


>The DWARF3 standard defines:
>  A base type entry has a DW_AT_byte_size attribute, whose value (see Section
>  2.19) is the size in bytes of the storage unit used to represent an object of
>  the given type.
>
>
>The phrase 'bytes of the storage unit used' to me explains that the size of a
>byte depends on the architecture and thus is not an 8-bit entity by
>definition. Unfortunately, the DWARF document nowhere gives an explanation of
>the term 'byte'.

This appears to be an ambiguity in how to interpret the English words of the
standard.  The choice is between:
    ...the size (in bytes-of-the-storage-unit) used...
where bytes-of-the-storage-unit implies a target-architecture-dependent unit;
and
    ...the size (in bytes) of the storage unit [quantity of memory] used...
where "bytes" is nearly but not quite universally understood to mean the
traditional one-character storage size which has long been defined as 8 bits.

Having "grown up" on a 36-bit word-addressed machine (the PDP-10) that did
not have a fixed byte size (although 7 bits was most common), I am familiar
with the tension between "byte" size and "addressable-unit" size.  But these
days "byte" pretty much always means the traditional character-sized unit,
and Michael Eager explained how the standard uses 'storage unit'.  So, the
standard ought to be interpreted the second way.  I think the only reason
it bothers to say "size in bytes" is to make it clear we don't want it to
be "size in bits" but doesn't imply anything architecture-dependent.

--paulr




More information about the Dwarf-discuss mailing list