liveBook · Manning

In-memory format

As explained in Modern C, Third Edition

An object representation is a model describing the physical or storage-level encoding of a value in memory.

An in-memory format, or object representation, describes how a value is physically encoded in storage. It differs from binary representation, which models a type’s possible values and operations. C treats each object as a collection of bytes, while virtual memory hides the underlying physical location. section 12.0 section 5.1.3

An int32_t across representation layers

A platform may map int32_t to a 32-bit signed integer and store its bytes in little-endian order. The value model, binary representation, object representation, virtual memory, and physical memory describe progressively different levels of the same value.

Key constraints follow from treating storage as an object representation:

  • Inspecting bytes can reveal an object representation when the object’s address is available. section 5.1.3
  • Unions can overlay different object types on the same representation, while alignment and effective types constrain valid access. section 12.8
  • The same value can have different binary representations, and its object representation is likewise tied to the platform’s storage model. section 5.7 section 5.1.3
Figure 12.1 The different levels of the value-memory model for an int32_t. Example of a platform that maps this type to a 32-bit signed int and uses a little-endian object representation.
figure

Use the layered diagram to compare a value’s abstract model with its binary, object, virtual-memory, and physical-memory representations. section 12.0

How Modern C, Third Edition covers it

How deep it goes
Explains representation layers, byte inspection, unions, alignment, and effective types without detailing every access rule.
Examples
Uses an int32_t little-endian layout, byte-array views, and unions as concrete ways to examine storage.
What it assumes
Assumes basic C types and pointers while treating object representation and its relationship to binary representation explicitly.
What you can do after
Evaluate/understand how C separates values, byte storage, and platform-specific memory representations.
How it connects
Connects object representation with binary representation, virtual memory, pointers, unions, alignment, and effective types.

Also explained in

Compare how 2 books explain in-memory format →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern C, Third Edition. The section links point to the parts of the book it draws on.