Search code examples
c++clanguage-lawyerstandardsmemory-model

Is Byte Really The Minimum Addressable Unit?


Section 3.6 of C11 standard defines "byte" as "addressable unit of data storage ... to hold ... character".

Section 1.7 of C++11 standard defines "byte" as "the fundamental storage unit in the C++ memory model ... to contain ... character".

Both definitions does not say that "byte" is the minimum addressable unit. Is this because standards intentionally want to abstract from a specific machine ? Can you provide a real example of machine where C/C++ compiler were decided to have "byte" longer/shorter than the minimum addressable unit ?


Solution

  • (Thank you everyone who commented and answered, every word helps)

    Memory model of a programming language and memory model of the target machine are different things.

    Yes, byte is the minimum addressable unit in context of memory model of programming language.

    No, byte is not the minimum addressable unit in context of memory model of machine. For example, there are machines where minimum addressable unit is longer or shorter than the "byte" of programming language:

    • longer: HP Saturn - 4-bit unit vs 8-bit byte gcc (thanks Nate).
    • shorter: IBM 7090 - 36-bit unit vs 6-bit byte (thanks Antti and Dave T.)
    • longer: Intel 8051 - 1-bit unit vs 8-bit byte (thanks Busybee)
    • longer: Ti TMS34010 - 1-bit unit vs 8-bit byte (thanks Wcochran)