liveBook · Manning

Opaque object

An opaque object is an object whose representation and contents are hidden and accessible only through specified operations.

How 2 Manning books explain it

Modern C

An opaque object is an object whose representation and contents can be accessed only through operations explicitly permitted by its abstraction.

How it is used
Uses opacity to reason about pointers and to separate library interfaces from hidden structure implementations.
How deep it goes
Defines permitted pointer operations and states, then explains forward declarations, stopping short of structure implementation details.
Examples
Uses string pointers, empty and null pointers, indeterminate pointers, and a forward-declared `struct toto` interface.
What you can do after
Evaluate C pointer states and design interfaces that conceal structure representations without hiding pointer semantics.

Read how Modern C explains opaque object →

Modern C, Third Edition

An opaque structure is a C structure type whose complete member definition is hidden from code that uses its interface.

How it is used
Separates a library's public interface from its hidden structure implementation.
How deep it goes
Defines forward declarations, pointer use, representation rationale, and typedef visibility, but not the hidden structure's members.
Examples
Uses a forward-declared struct toto with get, destroy, and operation functions, plus pointer typedef alternatives.
What you can do after
Builds a client-facing C interface around a structure whose definition remains private to its implementation.

Read how Modern C, Third Edition explains opaque object →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.