Chapter 12. The C memory model

This chapter covers

  • Understanding object representations
  • Working with untyped pointers and casts
  • Restricting object access with effective types and alignment

Pointers present us with a certain abstraction of the environment and state in which our program is executed, the C memory model. We may apply the unary operator & to (almost) all objects[1] to retrieve their address and use it to inspect and change the state of our execution.

1

Only objects that are declared with keyword register don’t have an address; see section 13.2.2 on level 2.

This access to objects via pointers is still an abstraction, because seen from C, no distinction of the “real” location of an object is made. It could reside in your ...

Get Modern C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.